Class Color

java.lang.Object
io.keikai.axyra.sheets.style.Color

public final class Color extends Object
A typed spreadsheet color: plain ARGB, a legacy indexed-palette reference, a theme-palette reference with an optional tint, or the automatic (window-text) color — mirroring OOXML's color forms (ECMA-376 §18.8.3 CT_Color). Construct with rgb(int, int, int), argb, indexed(int), theme(int), or auto(); inspect with isRgb(), isIndexed(), isTheme(), isAuto() and the matching readers.

Crosses the JNI boundary as a structured JSON object ({"rgb":"#AARRGGBB"}, {"indexed":N}, {"theme":I,"tint":T}, or {"auto":true}).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Color
     
    static final Color
     
    static final Color
     
    static final Color
     
    static final Color
     
    static final Color
     
    static final Color
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    The packed 0xAARRGGBB value of an RGB color.
    static Color
    argb(int a, int r, int g, int b)
    Color from 8-bit a/r/g/b.
    static Color
    The automatic (window-text) color.
    int
     
    boolean
     
    static Color
    Decode the FFI JSON color form: a structured map ({"rgb": ...} / {"indexed": N} / {"theme": I, "tint": T} / {"auto": true}) or a legacy string.
    int
     
    int
     
    static Color
    indexed(int index)
    A legacy indexed-palette color (ECMA-376 §18.8.27; index 0-255).
    int
    The palette index of an indexed color.
    boolean
    Whether this is the automatic (window-text) color.
    boolean
    Whether this is a legacy indexed-palette color.
    boolean
    Whether this is a plain ARGB color.
    boolean
    Whether this is a theme-palette color.
    static Color
    of(int argb)
    Color from a packed 0xAARRGGBB int.
    static Color
    Parse "#RRGGBB" / "#AARRGGBB" (plus the legacy engine tokens "auto", "indexed:N", "theme:I:TINT_FP"); returns null for anything else.
    int
    red()
     
    static Color
    rgb(int r, int g, int b)
    Opaque color from 8-bit r/g/b.
    static Color
    theme(int themeIndex)
    A theme-palette color with no tint (theme slot 0-11).
    static Color
    theme(int themeIndex, double tint)
    A theme-palette color: themeIndex is the theme slot (0-11: dark1, light1, dark2, light2, accent1-6, hyperlink, followedHyperlink) and tint lightens (positive) or darkens (negative) it, in [-1, 1] (ECMA-376 §18.8.19).
    int
    The theme slot (0-11) of a theme color.
    double
    The tint in [-1, 1] of a theme color.
    "#AARRGGBB" of an RGB color.
    The structured JSON value crossed to the engine.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • BLACK

      public static final Color BLACK
    • WHITE

      public static final Color WHITE
    • RED

      public static final Color RED
    • GREEN

      public static final Color GREEN
    • BLUE

      public static final Color BLUE
    • YELLOW

      public static final Color YELLOW
    • GRAY

      public static final Color GRAY
  • Method Details

    • rgb

      public static Color rgb(int r, int g, int b)
      Opaque color from 8-bit r/g/b.
    • argb

      public static Color argb(int a, int r, int g, int b)
      Color from 8-bit a/r/g/b.
    • of

      public static Color of(int argb)
      Color from a packed 0xAARRGGBB int.
    • indexed

      public static Color indexed(int index)
      A legacy indexed-palette color (ECMA-376 §18.8.27; index 0-255).
    • theme

      public static Color theme(int themeIndex)
      A theme-palette color with no tint (theme slot 0-11).
    • theme

      public static Color theme(int themeIndex, double tint)
      A theme-palette color: themeIndex is the theme slot (0-11: dark1, light1, dark2, light2, accent1-6, hyperlink, followedHyperlink) and tint lightens (positive) or darkens (negative) it, in [-1, 1] (ECMA-376 §18.8.19).
    • auto

      public static Color auto()
      The automatic (window-text) color.
    • parse

      public static Color parse(String s)
      Parse "#RRGGBB" / "#AARRGGBB" (plus the legacy engine tokens "auto", "indexed:N", "theme:I:TINT_FP"); returns null for anything else.
    • fromJson

      public static Color fromJson(Object value)
      Decode the FFI JSON color form: a structured map ({"rgb": ...} / {"indexed": N} / {"theme": I, "tint": T} / {"auto": true}) or a legacy string. Returns null for an unrecognized value. Not intended for application code — public only for the sibling DTO packages.
    • toJsonValue

      public Object toJsonValue()
      The structured JSON value crossed to the engine. Not intended for application code — public only for the sibling DTO packages.
    • isRgb

      public boolean isRgb()
      Whether this is a plain ARGB color.
    • isIndexed

      public boolean isIndexed()
      Whether this is a legacy indexed-palette color.
    • isTheme

      public boolean isTheme()
      Whether this is a theme-palette color.
    • isAuto

      public boolean isAuto()
      Whether this is the automatic (window-text) color.
    • indexedValue

      public int indexedValue()
      The palette index of an indexed color.
    • themeIndex

      public int themeIndex()
      The theme slot (0-11) of a theme color.
    • tint

      public double tint()
      The tint in [-1, 1] of a theme color.
    • argb

      public int argb()
      The packed 0xAARRGGBB value of an RGB color.
    • alpha

      public int alpha()
    • red

      public int red()
    • green

      public int green()
    • blue

      public int blue()
    • toHex

      public String toHex()
      "#AARRGGBB" of an RGB color.
    • 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