public class EaselColors
extends java.lang.Object
Contains various color-related helper functions and a collection of pre-chosen colors. Choosing a color from the provided sets (e.g. the QUAL_
series) should be determined by various concerns regarding readability and purpose - don't just choose your colors randomly based on what you think might look nice! Included colors are designed to be readable against a specific background color, TOOLTIP_BASE()
, and may NOT be as readable if you have something different. Accessibility concerns involving colorblindness are left for you to handle.
The "qualitative" QUAL_
series of colors are intended to be used to differentiate elements of distinct categories. Use this set when you have multiple, unrelated items needing to be visually distinct from each other without sacrificing readability.
The "sequential" SEQ_
series of colors are intended to be used to indicate a progression of elements from the same category. Use elements of these sets (e.g. SEQ_BLUE_0()
, SEQ_BLUE_1()
, SEQ_BLUE_2()
) to indicate ordered values, with the lighter more desaturated colors (close to 0) typically depicting something smaller in magnitude, with the darker more saturated colors (close to 4) depicting something larger. You may not need all colors inside a set and can skip intermediate ramps if it aids visual clarity (though make sure the order is increasing in the proper way). You typically don't want to mix and match colors from different sequential sets (i.e. don't use SEQ_BLUE_0()
followed by SEQ_RED_1()
: use only blue or only red), as that conveys different meaning (you may want a qualitative set instead).
A third, but less common, series of color ramps ("diverging" palettes) can be used to indicate a progression of values as they blend between two distinct categories. As this set isn't as applicable to the vast majority of mods as the other sets, Easel does not include any colors for this type. You may simulate it by taking the pieces of one sequential set (e.g. SEQ_BLUE_4()
, SEQ_BLUE_2()
), passing it through a neutral white color (Color.WHITE
, and then taking pieces of a second sequential set (e.g. SEQ_RED_2()
, SEQ_RED_4()
for the other side. If you use this approach, the darker, more saturated colors are for the extremes and they fade to desaturated white in the middle. E.g.: [dark blue → light blue → white → light red → dark red].
More details about these types of color palettes and their intended use can be found by searching for "Color Brewer palettes" on your search engine, or by reading over the original paper (Harrower, Mark, and Cynthia A. Brewer. "ColorBrewer.org: an online tool for selecting colour schemes for maps." The Cartographic Journal 40.1 (2003))
Modifier and Type | Field and Description |
---|---|
static com.badlogic.gdx.graphics.Color |
EIGHTH_TRANSPARENT_WHITE |
static com.badlogic.gdx.graphics.Color |
HALF_TRANSPARENT_WHITE |
static com.badlogic.gdx.graphics.Color |
ONE_TENTH_TRANSPARENT_BLACK |
Constructor and Description |
---|
EaselColors() |
Modifier and Type | Method and Description |
---|---|
static com.badlogic.gdx.graphics.Color |
darken(com.badlogic.gdx.graphics.Color color)
Convenience function to make colors ~10% darker.
|
static com.badlogic.gdx.graphics.Color |
darken(com.badlogic.gdx.graphics.Color color,
float amt)
Creates a copy of the given color darkened by a given amount.
|
static com.badlogic.gdx.graphics.Color |
HEADER_BLUE() |
static com.badlogic.gdx.graphics.Color |
HEADER_DARK_ALGAE() |
static com.badlogic.gdx.graphics.Color |
HEADER_DEEP_BLUE() |
static com.badlogic.gdx.graphics.Color |
HEADER_GREEN() |
static com.badlogic.gdx.graphics.Color |
HEADER_LIGHT_ALGAE() |
static com.badlogic.gdx.graphics.Color |
HEADER_PURPLE() |
static com.badlogic.gdx.graphics.Color |
HEADER_RED() |
static com.badlogic.gdx.graphics.Color |
HEADER_SEA_GLASS() |
static com.badlogic.gdx.graphics.Color |
HEADER_SLATE() |
static com.badlogic.gdx.graphics.Color |
HEADER_STRONG_BLUE() |
static com.badlogic.gdx.graphics.Color |
HEADER_STRONG_GREEN() |
static com.badlogic.gdx.graphics.Color |
HEADER_STRONG_PURPLE() |
static com.badlogic.gdx.graphics.Color |
HEADER_STRONG_RED() |
static com.badlogic.gdx.graphics.Color |
HEADER_WOOD() |
static com.badlogic.gdx.graphics.Color |
lighten(com.badlogic.gdx.graphics.Color color)
Convenience function to make colors ~10% brighter.
|
static com.badlogic.gdx.graphics.Color |
lighten(com.badlogic.gdx.graphics.Color color,
float amt)
Creates a copy of the given color lightened by a given amount.
|
static com.badlogic.gdx.graphics.Color |
QUAL_BLUE() |
static com.badlogic.gdx.graphics.Color |
QUAL_GREEN() |
static com.badlogic.gdx.graphics.Color |
QUAL_PURPLE() |
static com.badlogic.gdx.graphics.Color |
QUAL_RED() |
static com.badlogic.gdx.graphics.Color |
QUAL_YELLOW() |
static com.badlogic.gdx.graphics.Color |
rainbow() |
static com.badlogic.gdx.graphics.Color |
SEQ_BLUE_0() |
static com.badlogic.gdx.graphics.Color |
SEQ_BLUE_1() |
static com.badlogic.gdx.graphics.Color |
SEQ_BLUE_2() |
static com.badlogic.gdx.graphics.Color |
SEQ_BLUE_3() |
static com.badlogic.gdx.graphics.Color |
SEQ_BLUE_4() |
static com.badlogic.gdx.graphics.Color |
SEQ_GREEN_0() |
static com.badlogic.gdx.graphics.Color |
SEQ_GREEN_1() |
static com.badlogic.gdx.graphics.Color |
SEQ_GREEN_2() |
static com.badlogic.gdx.graphics.Color |
SEQ_GREEN_3() |
static com.badlogic.gdx.graphics.Color |
SEQ_GREEN_4() |
static com.badlogic.gdx.graphics.Color |
SEQ_PURPLE_0() |
static com.badlogic.gdx.graphics.Color |
SEQ_PURPLE_1() |
static com.badlogic.gdx.graphics.Color |
SEQ_PURPLE_2() |
static com.badlogic.gdx.graphics.Color |
SEQ_PURPLE_3() |
static com.badlogic.gdx.graphics.Color |
SEQ_PURPLE_4() |
static com.badlogic.gdx.graphics.Color |
SEQ_RED_0() |
static com.badlogic.gdx.graphics.Color |
SEQ_RED_1() |
static com.badlogic.gdx.graphics.Color |
SEQ_RED_2() |
static com.badlogic.gdx.graphics.Color |
SEQ_RED_3() |
static com.badlogic.gdx.graphics.Color |
SEQ_RED_4() |
static com.badlogic.gdx.graphics.Color |
SEQ_YELLOW_0() |
static com.badlogic.gdx.graphics.Color |
SEQ_YELLOW_1() |
static com.badlogic.gdx.graphics.Color |
SEQ_YELLOW_2() |
static com.badlogic.gdx.graphics.Color |
SEQ_YELLOW_3() |
static com.badlogic.gdx.graphics.Color |
SEQ_YELLOW_4() |
static com.badlogic.gdx.graphics.Color |
TOOLTIP_BASE() |
static com.badlogic.gdx.graphics.Color |
TOOLTIP_TRIM_HIGHLIGHT() |
static com.badlogic.gdx.graphics.Color |
TOOLTIP_TRIM() |
static com.badlogic.gdx.graphics.Color |
withOpacity(com.badlogic.gdx.graphics.Color color,
float alpha)
Creates a copy of the given color with the new alpha transparency.
|
static com.badlogic.gdx.graphics.Color |
withOpacity(com.badlogic.gdx.graphics.Color color,
float targetAlpha,
InterpolationSpeed withDelay)
Creates a copy of the given color with a new alpha transparency interpolated towards the
targetAlpha . |
public static final com.badlogic.gdx.graphics.Color ONE_TENTH_TRANSPARENT_BLACK
public static final com.badlogic.gdx.graphics.Color HALF_TRANSPARENT_WHITE
public static final com.badlogic.gdx.graphics.Color EIGHTH_TRANSPARENT_WHITE
public static com.badlogic.gdx.graphics.Color withOpacity(com.badlogic.gdx.graphics.Color color, float alpha)
color
- the source color (RGB remains intact)alpha
- the desired opacity in [0.0, 1.0].withOpacity(Color, float, InterpolationSpeed)
public static com.badlogic.gdx.graphics.Color withOpacity(com.badlogic.gdx.graphics.Color color, float targetAlpha, InterpolationSpeed withDelay)
targetAlpha
. The new alpha is determined by the InterpolationSpeed's blending of the original color.a
and targetAlpha
; once the alpha is "sufficiently close", the interpolation snaps exactly to the targetAlpha
. This function is intended to be called repeatedly each frame to interpolate the color successfully.color
- the source color (RGB remains intact)targetAlpha
- the desired opacity in [0.0, 1.0]withDelay
- how quickly the source alpha morphs towards the targetAlphawithOpacity(Color, float)
public static com.badlogic.gdx.graphics.Color lighten(com.badlogic.gdx.graphics.Color color, float amt)
amt
to each channel (red, green, and blue), to shift it towards white. As RGB is NOT a perceptually uniform color space, this lightening is not be guaranteed to look perfect, but for most uses it works well enough. The closer that amt
is to 1.0f, the more white that will be applied. Negative values have the effect of darkening towards black (see darken(Color, float)
)color
- the source color to lightenamt
- the amount to lighten, inside [0.0, 1.0]darken(Color, float)
,
lighten(Color)
public static com.badlogic.gdx.graphics.Color lighten(com.badlogic.gdx.graphics.Color color)
lighten(Color, float)
with an amt = 0.1f
.color
- the source color to lightenlighten(Color, float)
public static com.badlogic.gdx.graphics.Color darken(com.badlogic.gdx.graphics.Color color, float amt)
lighten(Color, float)
with an inverted amt
, making it subtract from each RGB channel instead of add.color
- the source color to darkenamt
- the amount to darken, inside [0.0, 1.0]lighten(Color, float)
,
darken(Color)
public static com.badlogic.gdx.graphics.Color darken(com.badlogic.gdx.graphics.Color color)
darken(Color, float)
with an amt = 0.1f
.color
- the source color to darkendarken(Color, float)
public static com.badlogic.gdx.graphics.Color rainbow()
public static com.badlogic.gdx.graphics.Color TOOLTIP_BASE()
public static com.badlogic.gdx.graphics.Color TOOLTIP_TRIM()
public static com.badlogic.gdx.graphics.Color TOOLTIP_TRIM_HIGHLIGHT()
public static com.badlogic.gdx.graphics.Color QUAL_RED()
public static com.badlogic.gdx.graphics.Color QUAL_GREEN()
public static com.badlogic.gdx.graphics.Color QUAL_BLUE()
public static com.badlogic.gdx.graphics.Color QUAL_PURPLE()
public static com.badlogic.gdx.graphics.Color QUAL_YELLOW()
public static com.badlogic.gdx.graphics.Color HEADER_STRONG_RED()
public static com.badlogic.gdx.graphics.Color HEADER_STRONG_BLUE()
public static com.badlogic.gdx.graphics.Color HEADER_STRONG_GREEN()
public static com.badlogic.gdx.graphics.Color HEADER_STRONG_PURPLE()
public static com.badlogic.gdx.graphics.Color HEADER_RED()
public static com.badlogic.gdx.graphics.Color HEADER_BLUE()
public static com.badlogic.gdx.graphics.Color HEADER_GREEN()
public static com.badlogic.gdx.graphics.Color HEADER_PURPLE()
public static com.badlogic.gdx.graphics.Color HEADER_DEEP_BLUE()
public static com.badlogic.gdx.graphics.Color HEADER_SLATE()
public static com.badlogic.gdx.graphics.Color HEADER_SEA_GLASS()
public static com.badlogic.gdx.graphics.Color HEADER_WOOD()
public static com.badlogic.gdx.graphics.Color HEADER_LIGHT_ALGAE()
public static com.badlogic.gdx.graphics.Color HEADER_DARK_ALGAE()
public static com.badlogic.gdx.graphics.Color SEQ_RED_0()
public static com.badlogic.gdx.graphics.Color SEQ_RED_1()
public static com.badlogic.gdx.graphics.Color SEQ_RED_2()
public static com.badlogic.gdx.graphics.Color SEQ_RED_3()
public static com.badlogic.gdx.graphics.Color SEQ_RED_4()
public static com.badlogic.gdx.graphics.Color SEQ_BLUE_0()
public static com.badlogic.gdx.graphics.Color SEQ_BLUE_1()
public static com.badlogic.gdx.graphics.Color SEQ_BLUE_2()
public static com.badlogic.gdx.graphics.Color SEQ_BLUE_3()
public static com.badlogic.gdx.graphics.Color SEQ_BLUE_4()
public static com.badlogic.gdx.graphics.Color SEQ_GREEN_0()
public static com.badlogic.gdx.graphics.Color SEQ_GREEN_1()
public static com.badlogic.gdx.graphics.Color SEQ_GREEN_2()
public static com.badlogic.gdx.graphics.Color SEQ_GREEN_3()
public static com.badlogic.gdx.graphics.Color SEQ_GREEN_4()
public static com.badlogic.gdx.graphics.Color SEQ_PURPLE_0()
public static com.badlogic.gdx.graphics.Color SEQ_PURPLE_1()
public static com.badlogic.gdx.graphics.Color SEQ_PURPLE_2()
public static com.badlogic.gdx.graphics.Color SEQ_PURPLE_3()
public static com.badlogic.gdx.graphics.Color SEQ_PURPLE_4()
public static com.badlogic.gdx.graphics.Color SEQ_YELLOW_0()
public static com.badlogic.gdx.graphics.Color SEQ_YELLOW_1()
public static com.badlogic.gdx.graphics.Color SEQ_YELLOW_2()
public static com.badlogic.gdx.graphics.Color SEQ_YELLOW_3()
public static com.badlogic.gdx.graphics.Color SEQ_YELLOW_4()