- Reporting bugs
- Suggesting features
- Setup
- Adding a color space
- Adding a grayscale method
- Pull requests
- Further reading
Open an issue with:
- Java version and OS
- Code snippet that reproduces the problem
- Expected vs actual result
- If it's a color accuracy issue, include the input values, target space, and what the correct output should be (with source/reference)
Open an issue describing the use case before writing code. For new color spaces, include a link to the reference paper or specification.
git clone https://github.com/PedroFellipeAntunes/Colorimetry-java.git
cd Colorimetry-java
mvn compileRequires Java 11+.
- Create a class in the appropriate subpackage under
colorimetry/spaces/(e.g.spaces/hue/,spaces/perceptual/,spaces/cam/). ImplementColorSpace. - Add a
public static final INSTANCEsingleton as the first field. - Implement metadata:
displayName,componentCount,componentName,componentMin,componentMax,componentDefault,componentStep. - Declare
parentSpace()- pick the closest existing space in the hierarchy. - Implement
toParent()andfromParent()with the conversion math. - Implement
normalize()anddenormalize()for the 0-1 range mapping. - Root spaces (parent =
Xyz) must also overrideisBounded(). Child spaces inherit this from their root ancestor. - For cylindrical spaces, override
isCylindrical()(returntrue),hueChannel(), andradialChannel(). - For spaces where only some channels are bounded, override
isChannelBounded(int i). - For spaces with a configurable parent, implement a static
of(parent)factory and overrideacceptedParentType()returning the appropriate marker interface (RgbLike.class,XyzLike.class, orLabLike.class). - Register in
ColorSpaceRegistrystatic block. - Run
ColorSpaceAtlasTest,ColorSpaceTreeTest,ColorSpaceGamutExport, andRoundTripTestto verify. See Testing for details on each test and its arguments.
- Create a class in the appropriate subpackage under
colorimetry/grayscale/(e.g.grayscale/luma/,grayscale/perceptual/,grayscale/simple/,grayscale/channel/). ImplementGrayscale. - Add a
public static final INSTANCEsingleton. - Implement
nativeSpace()- return the color space where the method operates (e.g.CieLab.INSTANCE,Oklab.INSTANCE,SRgb.INSTANCE). - Implement
toGrayNative()- receives raw values in the native space, returns achromatic values in the same space (e.g. zero chromatic channels). Thedefault toGrayin the interface handles conversion to/from the native space automatically. - For luma-weighted methods, use the shared
Grayscale.applyLuma(raw, luma)utility with coefficients fromRgbLike.lumaCoefficients(). - Register in
GrayscaleRegistrystatic block. - Run
GrayscaleGradientTestandGrayscaleAtlasTestto verify the result visually. See Testing for details.
- One feature per PR.
- Branch from
main. - Follow the code style.
- Run the relevant tests for what you changed (see Adding a color space or Adding a grayscale method) and check the output before submitting.
- Describe what was changed and why in the PR description.
- Code style - formatting rules, section headers, and comment conventions.
- Architecture - conversion pipeline, gamut mapping, and internal design.
- Testing - all test programs, what they do, and how to run them.