Class SwatchPalette

java.lang.Object
com.iizigo.prop.editor.color.swt.SwatchPalette

public final class SwatchPalette extends Object
The generated palette of the Swatches tab (CC-COLOR-CHOOSER-SWT-PANELS, 2026-10-10): the same palette the Swing swatch panel of CC-FIX-COLOR-CHOOSER generated, computed from the HSV model rather than from a table, so that it is a pure function of the cell.

31 columns by 9 rows. Column 0 is a gray ramp from white (row 0) to black (row 8). Columns 1 to 30 are the hues at 12 degree steps; rows 0 to 3 are tints (saturation 0.2, 0.4, 0.6, 0.8 at full value), row 4 the pure hue, rows 5 to 8 shades (full saturation, value 0.82, 0.64, 0.46, 0.28).

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The columns: one gray ramp and 30 hues.
    static final int
    The number of hues.
    static final int
    The rows: four tints, the pure color, four shades.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    colorAt(int index)
    Gets a color of the palette by its row-major index.
    static int
    colorAt(int column, int row)
    Gets a color of the palette as a pure function of its cell.
    static int[]
    Gets the palette, row by row (index=row*COLUMNS+column), built once.
  • Field Details

  • Method Details

    • colorAt

      public static int colorAt(int column, int row)
      Gets a color of the palette as a pure function of its cell.
      Parameters:
      column - 0 to COLUMNS-1.
      row - 0 to ROWS-1.
      Returns:
      The opaque color.
      Throws:
      IndexOutOfBoundsException - For a cell outside the palette.
    • colors

      public static int[] colors()
      Gets the palette, row by row (index=row*COLUMNS+column), built once. The array is shared: do not write into it.
    • colorAt

      public static int colorAt(int index)
      Gets a color of the palette by its row-major index.
      Parameters:
      index - 0 to COLUMNS*ROWS-1.