Class TeXColor

java.lang.Object
org.scilab.forge.jlatexmath.TeXColor

public final class TeXColor extends Object
An immutable sRGB color with an alpha, 8 bits each. It has what the library used of java.awt.Color, with the same results: the constants, the constructors with integers (0 to 255) and with floats (0 to 1, rounded as AWT does), and decode(String).
  • Field Details

    • BLACK

      public static final TeXColor BLACK
    • WHITE

      public static final TeXColor WHITE
    • RED

      public static final TeXColor RED
    • GREEN

      public static final TeXColor GREEN
    • BLUE

      public static final TeXColor BLUE
    • CYAN

      public static final TeXColor CYAN
    • MAGENTA

      public static final TeXColor MAGENTA
    • YELLOW

      public static final TeXColor YELLOW
  • Constructor Details

    • TeXColor

      public TeXColor(int r, int g, int b)
    • TeXColor

      public TeXColor(int r, int g, int b, int a)
      Throws:
      IllegalArgumentException - if a component is not between 0 and 255
    • TeXColor

      public TeXColor(float r, float g, float b)
    • TeXColor

      public TeXColor(float r, float g, float b, float a)
      Throws:
      IllegalArgumentException - if a component is not between 0 and 1
  • Method Details

    • decode

      public static TeXColor decode(String s)
      Converts "#RRGGBB", "0xRRGGBB" or a decimal number.
      Throws:
      NumberFormatException - if the string is not a number
    • getRed

      public int getRed()
    • getGreen

      public int getGreen()
    • getBlue

      public int getBlue()
    • getAlpha

      public int getAlpha()
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object