Package rma.swing

Class RmaColor

java.lang.Object
java.awt.Color
rma.swing.RmaColor
All Implemented Interfaces:
Paint, Transparency, Serializable

public class RmaColor extends Color
See Also:
  • Field Details

    • darkred

      public static final Color darkred
      The color darkred. In the default sRGB space.
    • lightred

      public static final Color lightred
    • darkblue

      public static final Color darkblue
    • lightblue

      public static final Color lightblue
    • darkcyan

      public static final Color darkcyan
    • lightcyan

      public static final Color lightcyan
    • darkgreen

      public static final Color darkgreen
    • lightgreen

      public static final Color lightgreen
    • darkmagenta

      public static final Color darkmagenta
    • lightmagenta

      public static final Color lightmagenta
    • darkpink

      public static final Color darkpink
    • lightpink

      public static final Color lightpink
    • darkyellow

      public static final Color darkyellow
    • lightyellow

      public static final Color lightyellow
    • darkorange

      public static final Color darkorange
    • lightorange

      public static final Color lightorange
    • purple

      public static final Color purple
    • lightpurple

      public static final Color lightpurple
    • darkpurple

      public static final Color darkpurple
  • Constructor Details

    • RmaColor

      public RmaColor(int r, int g, int b)
      Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). The actual color used in rendering depends on finding the best match given the color space available for a given output device. Alpha is defaulted to 255.
      Parameters:
      r - the red component
      g - the green component
      b - the blue component
      See Also:
    • RmaColor

      public RmaColor(int r, int g, int b, int a)
      Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
      Parameters:
      r - the red component
      g - the green component
      b - the blue component
      a - the alpha component
      See Also:
    • RmaColor

      public RmaColor(int rgb)
      Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering depends on finding the best match given the color space available for a particular output device. Alpha is defaulted to 255.
      Parameters:
      rgb - the combined RGB components
      See Also:
    • RmaColor

      public RmaColor(int rgba, boolean hasalpha)
      Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. If the hasalpha argument is false, alpha is defaulted to 255.
      Parameters:
      rgba - the combined RGBA components
      hasalpha - true if the alpha bits are valid; false otherwise
      See Also:
    • RmaColor

      public RmaColor(float r, float g, float b)
      Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color used in rendering depends on finding the best match given the color space available for a particular output device.
      Parameters:
      r - the red component
      g - the green component
      b - the blue component
      See Also:
    • RmaColor

      public RmaColor(float r, float g, float b, float a)
      Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0). The actual color used in rendering depends on finding the best match given the color space available for a particular output device.
      Parameters:
      r - the red component
      g - the green component
      b - the blue component
      a - the alpha component
      See Also:
    • RmaColor

      public RmaColor(ColorSpace cspace, float[] components, float alpha)
      Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha. The number of components is determined by the type of the ColorSpace. For example, RGB requires 3 components, but CMYK requires 4 components.
      Parameters:
      cspace - the ColorSpace to be used to interpret the components
      components - an arbitrary number of color components that is compatible with the
      alpha - alpha value
      Throws:
      IllegalArgumentException - if any of the values in the components array or alpha is outside of the range 0.0 to 1.0
      See Also:
  • Method Details

    • parseColorString

      public static Color parseColorString(String colorString)
      return the Color specified by colorString
      Parameters:
      colorString - either a RGB value r,g,b or a color name "blue"
      Returns:
      the Color specified by colorStringg
    • color2String

      public static String color2String(Color c)
    • color2String

      public static String color2String(Color c, boolean returnRGBString)
      given a Color return it's string representation if it's a now color ( Color.red) or a darker(Color.red.darker()) or brigher (Color.red.brigher()) version of a color return darkcolor or lightcolor ie. darkred or lightred. if it's not any of those return a r,g,b string
      Returns:
      a string representation of the color.
    • getRGBString

      public static String getRGBString(Color c)
      Returns a comma delimited String of rgb and alpha.
    • parseRGBString

      public static Color parseRGBString(String rgbaStr)
      Parses the comma deliminated string into respective rgb and alpha values.
    • toString

      public String toString()
      Overrides:
      toString in class Color
    • getColorList

      public static List getColorList()