@@ -11,20 +11,62 @@ If you are using Maven, add the following to your `pom.xml` file:
1111 <dependency>
1212 <groupId>org.hsluv</groupId>
1313 <artifactId>hsluv</artifactId>
14- <version>0.2 </version>
14+ <version>1.0 </version>
1515 </dependency>
16-
17- # Documentation
1816
19- Javadocs: http://www.javadoc.io/doc/org.hsluv/hsluv
17+ # Usage
18+
19+ The API is designed to avoid heap allocation. The ` HSLuv ` class defines the following public fields:
20+
21+ - RGB: ` hex:String ` , ` rgb_r ` [ 0;1] , ` rgb_g ` [ 0;1] , ` rgb_r ` [ 0;1]
22+ - CIE XYZ: ` xyz_x ` , ` xyz_y ` , ` xyz_z `
23+ - CIE LUV: ` luv_l ` , ` luv_u ` , ` luv_v `
24+ - CIE LUV LCh: ` lch_l ` , ` lch_c ` , ` lch_h `
25+ - HSLuv: ` hsluv_h ` [ 0;360] , ` hsluv_s ` [ 0;100] , ` hsluv_l ` [ 0;100]
26+ - HPLuv: ` hpluv_h ` [ 0;360] , ` hpluv_p ` [ 0;100] , ` hpluv_l ` [ 0;100]
27+
28+ To convert between color spaces, simply set the properties of the source color space, run the
29+ conversion methods, then read the properties of the target color space.
30+
31+ Use the following methods to convert to and from RGB:
32+
33+ - HSLuv: ` hsluvToRgb() ` , ` hsluvToHex() ` , ` rgbToHsluv() ` , ` hexToHsluv() `
34+ - HPLuv: ` hpluvToRgb() ` , ` hpluvToHex() ` , ` rgbToHpluv() ` , ` hexToHpluv() `
35+
36+ Use the following methods to do step-by-step conversion:
37+
38+ - Forward: ` hsluvToLch() ` (or ` hpluvToLch() ` ), ` lchToLuv() ` , ` luvToXyz() ` , ` xyzToRgb() ` , ` rgbToHex() `
39+ - Backward: ` hexToRgb() ` , ` rgbToXyz() ` , ` xyzToLuv() ` , ` luvToLch() ` , ` lchToHsluv() ` (or ` lchToHpluv() ` )
40+
41+ For advanced usage, we also export the [ bounding lines] ( https://www.hsluv.org/math/ ) in slope-intercept
42+ format, two for each RGB channel representing the limit of the gamut.
43+
44+ - R < 0: ` r0s ` , ` r0i `
45+ - R > 1: ` r1s ` , ` r1i `
46+ - G < 0: ` g0s ` , ` g0i `
47+ - G > 1: ` g1s ` , ` g1i `
48+ - B < 0: ` b0s ` , ` b0i `
49+ - B > 1: ` b1s ` , ` b1i `
50+
51+ Example:
52+
53+ ``` java
54+ HsluvColorConverter conv = new HsluvColorConverter ();
55+ conv. hsluv_h = 10 ;
56+ conv. hsluv_s = 75 ;
57+ conv. hsluv_l = 65 ;
58+ conv. hsluvToHex();
59+ System . out. println(conv. hex); // Will print "#ec7d82"
60+ ```
2061
2162# Testing
2263
2364 mvn test
2465
2566# Deployment
2667
27- Docs:
68+ Docs:
69+
2870- https://central.sonatype.org/publish/publish-maven/
2971- https://central.sonatype.org/publish/requirements/gpg/
3072
@@ -59,4 +101,3 @@ Then run:
59101mvn versions:set -DnewVersion=0.3 # bump version
60102mvn clean deploy -P release
61103```
62-
0 commit comments