Module wonderful.util.palette
GPU color palettes.
Functions
| extract(color) | Extract RGB channel values from a color. |
| delta(color1, color2) | Calculate how much given colors differ visually. |
| generateT1Palette(secondColor) | Construct a new T1 palette. |
| generateT2Palette() | Construct a new T2 palette. |
| generateT3Palette() | Construct a new T3 palette. |
Fields
| t1 | A pre-generated T1 palette (the second color is 0xffffff). |
| t2 | A pre-generated T2 palette. |
| t3 | A pre-generated T3 palette with default palette colors. |
Class PaletteT1
| PaletteT1.deflate(a, a) | Convert a color to a palette index. |
| PaletteT1.inflate(a, an) | Convert a palette index to a color. |
Class PaletteT2
| PaletteT2.deflate(a, a) | Convert a color to a palette index. |
| PaletteT2.inflate(a, an) | Convert a palette index to a color. |
Class PaletteT3
| PaletteT3.inflate(a, an) | Convert a palette index to a color. |
| PaletteT3.deflate(a, a) | Convert a color to a palette index. |
Functions
- extract(color)
-
Extract RGB channel values from a color.
Parameters:
- color int a color
Returns:
- int a red channel value
- int a green channel value
- int a blue channel value
- delta(color1, color2)
-
Calculate how much given colors differ visually.
Parameters:
- color1 int the first color
- color2 int the second color
- generateT1Palette(secondColor)
-
Construct a new T1 palette.
Such a palette contains two colors, one of which is black.
Parameters:
- secondColor int the second color
Returns:
-
PaletteT1
the palette
- generateT2Palette()
-
Construct a new T2 palette.
Such a palette contains 16 fixed colors.
Returns:
-
PaletteT2
the palette
- generateT3Palette()
-
Construct a new T3 palette.
Such a palette contains 16 variable and 240 fixed colors. The variable colors
are set to shades of grey by default.
Returns:
-
PaletteT3
the palette
Fields
- t1
-
A pre-generated T1 palette (the second color is
0xffffff). - t2
- A pre-generated T2 palette.
- t3
- A pre-generated T3 palette with default palette colors.
Class PaletteT1
The T1 palette.
- PaletteT1.deflate(a, a)
-
Convert a color to a palette index.
Parameters:
- a int color
- a int color
Returns:
-
int
the palette index
- PaletteT1.inflate(a, an)
-
Convert a palette index to a color.
Parameters:
- a PaletteT1 palette
- an int index
Returns:
-
int
the color
Class PaletteT2
The T2 palette.
- PaletteT2.deflate(a, a)
-
Convert a color to a palette index.
Parameters:
- a int color
- a int color
Returns:
-
int
the palette index
- PaletteT2.inflate(a, an)
-
Convert a palette index to a color.
Parameters:
- a PaletteT2 palette
- an int index
Returns:
-
int
the color
Class PaletteT3
The T3 palette.
- PaletteT3.inflate(a, an)
-
Convert a palette index to a color.
Parameters:
- a PaletteT3 palette
- an int index
Returns:
-
int
the color
- PaletteT3.deflate(a, a)
-
Convert a color to a palette index.
Parameters:
- a int color
- a int color
Returns:
-
int
the palette index