A Color Expression and a set of Color Utilities used in the Style module. You can create a Color from an RGB String
or from a CSS color name:new Color("0,255,0")
or from a hexadecimal:new Color("silver")
or from a RGB List:new Color("#00ff00")
or from a RGB Map:new Color([0,255,0])
or from a HSL Map:new Color([r: 0, g: 255, b: 0, a: 125])
new Color([h: 0, s: 1.0, l: 0.5])
Fields inherited from class | Fields |
---|---|
class Expression |
filterFactory |
Type | Name and description |
---|---|
static java.util.Map |
colorNameMap CSS Color names |
Constructor and description |
---|
Color
(java.lang.Object value) Create a new Color from a value |
Type Params | Return Type | Name and description |
---|---|---|
|
java.awt.Color |
asColor() Get a java.awt.Color for this Color |
|
Color |
brighter(int n = 1) Create a new brighter Color |
|
Color |
darker(int n = 1) Create a new darker Color |
|
static void |
draw(java.util.List colors, java.lang.String orientation = "vertical", int size = 50) Draw a List of Colors to a JFrame |
|
static java.awt.image.BufferedImage |
drawToImage(java.util.List colors, java.lang.String orientation = "vertical", int size = 50) Draw a List of Colors to an Image |
|
java.lang.String |
getHex() Get this Color's hex value |
|
java.util.List |
getHsl() Get this Color's HSL value |
|
static java.util.List |
getPaletteColors(java.lang.String name, int count = -1) Get a List of Colors from a Palette by name |
|
static java.util.List |
getPaletteNames(java.lang.String type = "all") Get a List of Palette names by type (defaults to All) |
|
static Color |
getRandom() Generate a random color |
|
static Color |
getRandomPastel() Get a random pastel color |
|
java.util.List |
getRgb() Get this Color's RGB value |
|
java.util.List |
interpolate(Color color, int n = 10) Interpolate a List of Colors between this Color and the given Color |
|
static java.util.List |
interpolate(Color start, Color end, int n = 10) Interpolate a List Colors between the start and end Color |
|
static java.lang.String |
toHex(java.lang.Object color) Convert a Color to a hex color string |
Methods inherited from class | Name |
---|---|
class Expression |
evaluate, fromCQL, getValue, toString |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Create a new Color from a value
value
- The valueGet a java.awt.Color for this Color
Create a new brighter Color
n
- The number of times to brighten the Color. Defaults to 1.Create a new darker Color
n
- The number of times to darken the Color. Defaults to 1.Draw a List of Colors to a JFrame
colors
- The List of Colorsorientation
- The orientation (vertical or horizontal)size
- The size of each Color swatchDraw a List of Colors to an Image
colors
- The List of Colorsorientation
- The orientation (vertical or horizontal)size
- The size of each Color swatchGet this Color's hex value
Get this Color's HSL value
Get a List of Colors from a Palette by name
name
- The Palette namecount
- The number of colorsGet a List of Palette names by type (defaults to All)
type
- The type (all, diverging, qualitative, sequential)Generate a random color
Get a random pastel color
Get this Color's RGB value
Interpolate a List of Colors between this Color and the given Color
color
- The other Colorn
- The number of ColorsInterpolate a List Colors between the start and end Color
start
- The start Colorend
- The end Colorn
- The number of ColorsConvert a Color to a hex color string
color
- The color valueGroovy Documentation