Class ColorScience
java.lang.Object
org.episteme.social.arts.ColorScience
Advanced color science utility class for color space transformations,
perceptual difference calculations (Delta E), and color harmony generation.
This class provides high-precision implementations of CIE colorimetry standards.
- Since:
- 1.0
- Version:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]complementary(int r, int g, int b) Generates the complementary color (opposite on the color wheel).static RealdeltaE2000(double[] lab1, double[] lab2) Calculates Delta E (CIE2000) - modern standard for perceptual uniformity.static RealdeltaE76(double[] lab1, double[] lab2) Calculates Delta E (CIE76) - Euclidean distance in CIELAB space.static double[]rgbToLab(int r, int g, int b) Converts sRGB (0-255) to CIE Lab color space.static double[]rgbToXyz(int r, int g, int b) Converts sRGB to CIE XYZ.static int[][]triadic(int r, int g, int b) Generates triadic colors (three colors spaced 120° apart on the color wheel).static double[]xyzToLab(double x, double y, double z) Converts CIE XYZ to CIE Lab (D65 illuminant).
-
Method Details
-
rgbToLab
public static double[] rgbToLab(int r, int g, int b) Converts sRGB (0-255) to CIE Lab color space.- Parameters:
r- red component (0-255)g- green component (0-255)b- blue component (0-255)- Returns:
- array containing {L, a, b} components
-
rgbToXyz
public static double[] rgbToXyz(int r, int g, int b) Converts sRGB to CIE XYZ.- Parameters:
r- red component (0-255)g- green component (0-255)b- blue component (0-255)- Returns:
- array containing {X, Y, Z} components
-
xyzToLab
public static double[] xyzToLab(double x, double y, double z) Converts CIE XYZ to CIE Lab (D65 illuminant).- Parameters:
x- X componenty- Y componentz- Z component- Returns:
- array containing {L, a, b} components
-
deltaE76
Calculates Delta E (CIE76) - Euclidean distance in CIELAB space.- Parameters:
lab1- first color in Lab spacelab2- second color in Lab space- Returns:
- the color difference as a Real value
-
deltaE2000
Calculates Delta E (CIE2000) - modern standard for perceptual uniformity. This formula is significantly more complex than CIE76 but much closer to human perception.- Parameters:
lab1- first color in Lab spacelab2- second color in Lab space- Returns:
- the perceived color difference as a Real value
-
complementary
public static int[] complementary(int r, int g, int b) Generates the complementary color (opposite on the color wheel).- Parameters:
r- red componentg- green componentb- blue component- Returns:
- array containing {R, G, B} of the complementary color
-
triadic
public static int[][] triadic(int r, int g, int b) Generates triadic colors (three colors spaced 120° apart on the color wheel).- Parameters:
r- red componentg- green componentb- blue component- Returns:
- array of two RGB arrays representing the other two colors in the triad
-