CSSColor4J
is a simple Java library for parsing CSS color string representations.
- rgb[a](red, green, blue[, opacity])
- cmyk[a](cyan, magenta, yellow, black[, opacity])
- hsl[a](hue, saturation, lightness[, opacity])
- named color
- hexadecimal numbers
Color.valueOf("rgb(255, 0, 153)");
Color.valueOf("rgb(100%, 0%, 60%)");
Color.valueOf("rgb(255 0 153)");
Color.valueOf("rgb(255, 0, 153, 1)");
Color.valueOf("rgb(255, 0, 153, 100%)");
Color.valueOf("rgb(255 0 153 / 1)");
Color.valueOf("rgb(255 0 153 / 100%)");
Color.valueOf("rgb(1e2, .5e1, .5e0, .25e2%)");
Color.valueOf("rgba(51, 170, 51, .5)");
Color.valueOf("cmyk(1, 0, 0, 0)");
Color.valueOf("hsl(270, 60%, 70%)");
Color.valueOf("hsl(270deg, 60%, 70%)");
Color.valueOf("hsl(4.71239rad, 60%, 70%)");
Color.valueOf("hsl(300grad, 60%, 70%)");
Color.valueOf("hsl(.75turn, 60%, 70%)");
Color.valueOf("black");
Color.valueOf("rebeccapurple");
Color.valueOf("#f09");
Color.valueOf("#ff0099");
Color.valueOf("#ff0099ff");
<dependency>
<groupId>org.silentsoft</groupId>
<artifactId>csscolor4j</artifactId>
<version>1.0.0</version>
</dependency>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please note we have a CODE_OF_CONDUCT, please follow it in all your interactions with the project.
Please refer to LICENSE.