Class Colors

java.lang.Object
pl.poznan.put.constant.Colors

public final class Colors extends Object
A set of utility functions to work with palettes and color interpolation.
  • Method Details

    • getDistinctColors

      public static Color[] getDistinctColors()
      Returns:
      An array of 33 distinct colors.
    • interpolateColor

      public static Color interpolateColor(double value, double min, double max)
      Interpolates a color in red-green spectrum from its value and a given range [min; max].
      Parameters:
      value - A value to use in interpolation.
      min - The beginning of range.
      max - The end of range.
      Returns:
      An instance of Color from green-red spectrum which matches the value.
    • toHexString

      public static String toHexString(Color color)
      Converts a Color to hex String.
      Parameters:
      color - Color to be converted.
      Returns:
      A hex representation of the color.
    • toSvgString

      public static String toSvgString(Color color)
      Converts a Color to SVG String. For example red is rgb(255,0,0).
      Parameters:
      color - Color to be converted.
      Returns:
      An SVG representation of the color.