Class Color

java.lang.Object
software.xdev.chartjs.model.color.Color

public class Color extends Object
Immutable RGBa color model.
  • Field Details

    • TRANSPARENT

      public static final Color TRANSPARENT
    • BLACK

      public static final Color BLACK
    • WHITE

      public static final Color WHITE
    • RED

      public static final Color RED
    • LIME

      public static final Color LIME
    • BLUE

      public static final Color BLUE
    • YELLOW

      public static final Color YELLOW
    • CYAN

      public static final Color CYAN
    • MAGENTA

      public static final Color MAGENTA
    • SILVER

      public static final Color SILVER
    • GRAY

      public static final Color GRAY
    • MAROON

      public static final Color MAROON
    • OLIVE

      public static final Color OLIVE
    • GREEN

      public static final Color GREEN
    • PURPLE

      public static final Color PURPLE
    • TEAL

      public static final Color TEAL
    • DARK_RED

      public static final Color DARK_RED
    • BROWN

      public static final Color BROWN
    • CRIMSON

      public static final Color CRIMSON
    • DARK_SALMON

      public static final Color DARK_SALMON
    • SALMON

      public static final Color SALMON
    • LIGHT_SALMON

      public static final Color LIGHT_SALMON
    • ORANGE_RED

      public static final Color ORANGE_RED
    • DARK_ORANGE

      public static final Color DARK_ORANGE
    • ORANGE

      public static final Color ORANGE
    • GOLD

      public static final Color GOLD
    • DARK_KHAKI

      public static final Color DARK_KHAKI
    • KHAKI

      public static final Color KHAKI
    • YELLOW_GREEN

      public static final Color YELLOW_GREEN
    • DARK_OLIVE_GREEN

      public static final Color DARK_OLIVE_GREEN
    • GREEN_YELLOW

      public static final Color GREEN_YELLOW
    • DARK_GREEN

      public static final Color DARK_GREEN
    • DARK_CYAN

      public static final Color DARK_CYAN
    • LIGHT_CYAN

      public static final Color LIGHT_CYAN
    • AQUA

      public static final Color AQUA
    • DARK_TURQUOISE

      public static final Color DARK_TURQUOISE
    • TURQUOISE

      public static final Color TURQUOISE
    • MEDIUM_TURQUOISE

      public static final Color MEDIUM_TURQUOISE
    • PALE_TURQUOISE

      public static final Color PALE_TURQUOISE
    • AQUA_MARINE

      public static final Color AQUA_MARINE
    • LIGHT_BLUE

      public static final Color LIGHT_BLUE
    • SKY_BLUE

      public static final Color SKY_BLUE
    • LIGHT_SKY_BLUE

      public static final Color LIGHT_SKY_BLUE
    • MIDNIGHT_BLUE

      public static final Color MIDNIGHT_BLUE
    • DARK_BLUE

      public static final Color DARK_BLUE
    • MEDIUM_BLUE

      public static final Color MEDIUM_BLUE
    • BLUE_VIOLET

      public static final Color BLUE_VIOLET
    • VIOLET

      public static final Color VIOLET
    • DEEP_PINK

      public static final Color DEEP_PINK
    • HOT_PINK

      public static final Color HOT_PINK
    • LIGHT_PINK

      public static final Color LIGHT_PINK
    • PINK

      public static final Color PINK
    • LIGHT_YELLOW

      public static final Color LIGHT_YELLOW
    • CHOCOLATE

      public static final Color CHOCOLATE
    • TAN

      public static final Color TAN
    • LINEN

      public static final Color LINEN
    • LAVENDER

      public static final Color LAVENDER
    • AZURE

      public static final Color AZURE
    • DIM_GRAY

      public static final Color DIM_GRAY
    • DARK_GRAY

      public static final Color DARK_GRAY
    • LIGHT_GRAY

      public static final Color LIGHT_GRAY
  • Constructor Details

    • Color

      public Color(int r, int g, int b, double alpha)
      Constructs a new Color instance
      Parameters:
      r - value for Red color channel. Value between 0 and 255 (inclusive).
      g - value for Green color channel. Value between 0 and 255 (inclusive).
      b - value for Blue color channel. Value between 0 and 255 (inclusive).
      alpha - value for alpha transparency. Value between 0 and 1 (inclusive), with 0 fully transparent and 1 fully opaque.
    • Color

      public Color(int r, int g, int b)
      Constructs a new Color instance with alpha set fully opaque
      Parameters:
      r - value for Red color channel. Value between 0 and 255 (inclusive).
      g - value for Green color channel. Value between 0 and 255 (inclusive).
      b - value for Blue color channel. Value between 0 and 255 (inclusive).
    • Color

      public Color(Color color, double alpha)
      Constructs a new Color instance with the RGB values of the Color argument and the alpha transparency of the double argument.
  • Method Details

    • random

      public static Color random()
      Constructs and returns a new fully random Color instance.
      Returns:
      Color
    • isChannelWithinBounds

      public static boolean isChannelWithinBounds(int channel)

      Verify that argument is valid value for the R, G or B channel.

      Any integer between 0 and 255 (inclusive) is valid.

      Returns:
      true if argument is valid R, G or B value
    • isAlphaWithinBounds

      public static boolean isAlphaWithinBounds(double alpha)

      Verify that argument is valid value for the alpha channel.

      Any double between 0.0d and 1.0d (inclusive) is valid.

      Returns:
      true if argument is valid alpha value
    • getR

      public int getR()
      Returns:
      red channel value, between 0 and 255 (inclusive)
    • getG

      public int getG()
      Returns:
      green channel value, between 0 and 255 (inclusive)
    • getB

      public int getB()
      Returns:
      blue channel value, between 0 and 255 (inclusive)
    • getAlpha

      public double getAlpha()
      Returns:
      alpha channel value, between 0.0d and 1.0d (inclusive)
    • rgba

      public String rgba()
      Returns:
      serialized version of this Color, as used for JSON.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object