Package tripleplay.util
Class Colors
java.lang.Object
tripleplay.util.Colors
Utilities and constants for colors.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors.static final int
Named versions of commonly used colors. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
blend
(int c1, int c2) Blends two colors.static int
blend
(int c1, int c2, float p1) Blends two colors proportionally.static int
brighter
(int color) Creates a new brightened version of the given color.static int
darker
(int color) Creates a new darkened version of the given color with the default DARK_FACTOR.static int
darker
(int color, float darkFactor) Creates a new darkened version of the given color.
-
Field Details
-
WHITE
public static final int WHITENamed versions of commonly used colors. -
LIGHT_GRAY
public static final int LIGHT_GRAYNamed versions of commonly used colors. -
GRAY
public static final int GRAYNamed versions of commonly used colors. -
DARK_GRAY
public static final int DARK_GRAYNamed versions of commonly used colors. -
BLACK
public static final int BLACKNamed versions of commonly used colors. -
RED
public static final int REDNamed versions of commonly used colors. -
PINK
public static final int PINKNamed versions of commonly used colors. -
ORANGE
public static final int ORANGENamed versions of commonly used colors. -
YELLOW
public static final int YELLOWNamed versions of commonly used colors. -
GREEN
public static final int GREENNamed versions of commonly used colors. -
MAGENTA
public static final int MAGENTANamed versions of commonly used colors. -
CYAN
public static final int CYANNamed versions of commonly used colors. -
BLUE
public static final int BLUENamed versions of commonly used colors.
-
-
Constructor Details
-
Colors
public Colors()
-
-
Method Details
-
blend
public static int blend(int c1, int c2) Blends two colors.- Returns:
- a color halfway between the two colors.
-
blend
public static int blend(int c1, int c2, float p1) Blends two colors proportionally.- Parameters:
p1
- The percentage of the first color to use, from 0.0f to 1.0f inclusive.
-
darker
public static int darker(int color, float darkFactor) Creates a new darkened version of the given color. This is implemented by composing a new color consisting of the components of the original color, each multiplied by the dark factor. The alpha channel is copied from the original. -
darker
public static int darker(int color) Creates a new darkened version of the given color with the default DARK_FACTOR. -
brighter
public static int brighter(int color) Creates a new brightened version of the given color. This is implemented by composing a new color consisting of the components of the original color, each multiplied by 10/7, with exceptions for zero-valued components. The alpha channel is copied from the original.
-