diff --git a/colorsynth/_colorsynth.py b/colorsynth/_colorsynth.py index 93d4922..2666f69 100644 --- a/colorsynth/_colorsynth.py +++ b/colorsynth/_colorsynth.py @@ -11,7 +11,7 @@ "XYZcie1931_from_spd", "xyY_from_XYZ_cie", "XYZ_from_xyY_cie", - "srgb", + "sRGB", ] @@ -368,7 +368,7 @@ def XYZ_from_xyY_cie( return result -def srgb( +def sRGB( XYZ: np.ndarray, axis: int = -1, ) -> np.ndarray: @@ -413,7 +413,7 @@ def srgb( # Convert the tristimulus values into sRGB, the standard used in most # computer monitors - rgb = colorsynth.srgb(XYZ) + rgb = colorsynth.sRGB(XYZ) # Plot the result as an image plt.figure(); @@ -439,7 +439,7 @@ def srgb( XYZ = XYZ * np.array([0.9505, 1.0000, 1.0890])[..., np.newaxis] # Convert the tristimulus values into sRGB - r, g, b = np.clip(colorsynth.srgb(XYZ, axis=0), 0, 10) + r, g, b = np.clip(colorsynth.sRGB(XYZ, axis=0), 0, 10) plt.figure(); plt.plot(wavelength, r, color="red"); @@ -467,7 +467,7 @@ def srgb( ] XYZ = np.stack(XYZ, axis=-1) - rgb = colorsynth.srgb(XYZ, axis=-1) + rgb = colorsynth.sRGB(XYZ, axis=-1) # rgb = np.clip(rgb, 0, 1) # rgb[X < 0] = 1 diff --git a/colorsynth/_tests/test_colorsynth.py b/colorsynth/_tests/test_colorsynth.py index b998541..e014b2d 100644 --- a/colorsynth/_tests/test_colorsynth.py +++ b/colorsynth/_tests/test_colorsynth.py @@ -114,10 +114,10 @@ def test_XYZ_from_xyY_cie( @pytest.mark.parametrize("XYZ", XYZ) @pytest.mark.parametrize(argnames="axis", argvalues=[-1]) -def test_srgb( +def test_sRGB( XYZ: np.ndarray, axis: int, ): - result = colorsynth.srgb(XYZ, axis=axis) + result = colorsynth.sRGB(XYZ, axis=axis) assert isinstance(result, np.ndarray) assert result.shape[axis] == 3