Colour is an open-source Python package providing a comprehensive number of algorithms and datasets for colour science.
It is freely available under the BSD-3-Clause terms.
Colour is an affiliated project of NumFOCUS, a 501(c)(3) nonprofit in the United States.
Table of Contents
- 1 Draft Release Notes
- 2 Sponsors
- 3 Features
- 3.1 Automatic Colour Conversion Graph -
colour.graph - 3.2 Chromatic Adaptation -
colour.adaptation - 3.3 Algebra -
colour.algebra - 3.4 Colour Appearance Models -
colour.appearance - 3.5 Colour Blindness -
colour.blindness - 3.6 Colour Correction -
colour characterisation - 3.7 ACES Input Transform -
colour characterisation - 3.8 Colorimetry -
colour.colorimetry - 3.9 Contrast Sensitivity Function -
colour.contrast - 3.10 Colour Difference -
colour.difference - 3.11 IO -
colour.io - 3.12 Colour Models -
colour.models - 3.13 Colour Notation Systems -
colour.notation - 3.14 Optical Phenomena -
colour.phenomena - 3.15 Light Quality -
colour.quality - 3.16 Spectral Up-Sampling & Recovery -
colour.recovery - 3.17 Correlated Colour Temperature Computation Methods -
colour.temperature - 3.18 Colour Volume -
colour.volume - 3.19 Geometry Primitives Generation -
colour.geometry - 3.20 Plotting -
colour.plotting
- 3.1 Automatic Colour Conversion Graph -
- 4 User Guide
- 4.1 Installation
- 4.2 Tutorial
- 4.3 How-To
- 4.4 Contributing
- 4.5 Changes
- 4.6 Bibliography
- 5 API Reference
- 6 See Also
- 6.1 Software
- 7 Code of Conduct
- 8 Contact & Social
- 9 Thank You!
- 10 About
1 Draft Release Notes
The draft release notes of the develop branch are available at this url.
2 Sponsors
We are grateful for the support of our sponsors. If you'd like to join them, please consider becoming a sponsor on OpenCollective.
Gold Sponsors
Silver Sponsors
Bronze Sponsors
Donations & Special Sponsors
3 Features
Most of the objects are available from the colour namespace:
3.1 Automatic Colour Conversion Graph - colour.graph
colour.convert(sd, "Spectral Distribution", "sRGB", verbose={"mode": "Short"})
* *
* [ Conversion Path ] *
* *
* "sd_to_XYZ" --> "XYZ_to_sRGB" *
* *
===============================================================================
array([ 0.49034776, 0.30185875, 0.23587685])
colour.convert(
sd,
"Spectral Distribution",
"sRGB",
sd_to_XYZ={"illuminant": illuminant},
)
3.2 Chromatic Adaptation - colour.adaptation
D65 = colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"]
A = colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["A"]
colour.chromatic_adaptation(XYZ, colour.xy_to_XYZ(D65), colour.xy_to_XYZ(A))
3.3 Algebra - colour.algebra
3.3.1 Kernel Interpolation
x = range(len(y))
colour.KernelInterpolator(x, y)([0.25, 0.75, 5.50])
3.3.2 Sprague (1880) Interpolation
x = range(len(y))
colour.SpragueInterpolator(x, y)([0.25, 0.75, 5.50])
3.4 Colour Appearance Models - colour.appearance
XYZ_w = [95.05, 100.00, 108.88]
L_A = 318.31
Y_b = 20.0
colour.XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b)
3.5 Colour Blindness - colour.blindness
cmfs = colour.colorimetry.MSDS_CMFS_LMS["Stockman & Sharpe 2 Degree Cone Fundamentals"]
colour.msds_cmfs_anomalous_trichromacy_Machado2009(cmfs, np.array([15, 0, 0]))[450]
d_LMS = (15, 0, 0)
colour.matrix_anomalous_trichromacy_Machado2009(cmfs, primaries, d_LMS)
[ 0.27189369, 0.20047862, 0.52762768],
[ 0.00644047, 0.25921579, 0.73434374]])
3.6 Colour Correction - colour characterisation
RGB = [0.17224810, 0.09170660, 0.06416938]
M_T = np.random.random((24, 3))
M_R = M_T + (np.random.random((24, 3)) - 0.5) * 0.5
colour.colour_correction(RGB, M_T, M_R)
3.7 ACES Input Transform - colour characterisation
illuminant = colour.SDS_ILLUMINANTS["D55"]
colour.matrix_idt(sensitivities, illuminant)
[ 0.00457979, 1.14946003, -0.15403982],
[ 0.03552213, -0.16312291, 1.12760077]]), array([ 1.58214188, 1. , 1.28910346]))
3.8 Colorimetry - colour.colorimetry
3.8.1 Spectral Computations
3.8.2 Multi-Spectral Computations
[
[
[
0.01367208,
0.09127947,
0.01524376,
0.02810712,
0.19176012,
0.04299992,
],
[
0.00959792,
0.25822842,
0.41388571,
0.22275120,
0.00407416,
0.37439537,
],
[
0.01791409,
0.29707789,
0.56295109,
0.23752193,
0.00236515,
0.58190280,
],
],
[
[
0.01492332,
0.10421912,
0.02240025,
0.03735409,
0.57663846,
0.32416266,
],
[
0.04180972,
0.26402685,
0.03572137,
0.00413520,
0.41808194,
0.24696727,
],
[
0.00628672,
0.11454948,
0.02198825,
0.39906919,
0.63640803,
0.01139849,
],
],
[
[
0.04325933,
0.26825359,
0.23732357,
0.05175860,
0.01181048,
0.08233768,
],
[
0.02484169,
0.12027161,
0.00541695,
0.00654612,
0.18603799,
0.36247808,
],
[
0.03102159,
0.16815442,
0.37186235,
0.08610666,
0.00413520,
0.78492409,
],
],
[
[
0.11682307,
0.78883040,
0.74468607,
0.83375293,
0.90571451,
0.70054168,
],
[
0.06321812,
0.41898224,
0.15190357,
0.24591440,
0.55301750,
0.00657664,
],
[
0.00305180,
0.11288624,
0.11357290,
0.12924391,
0.00195315,
0.21771573,
],
],
]
)
colour.msds_to_XYZ(
msds,
method="Integration",
shape=colour.SpectralShape(400, 700, 60),
)
[ 17.12567298, 27.77681821, 25.52573685],
[ 19.10280411, 34.45851476, 29.76319628]],
[[ 18.03375827, 8.62340812, 9.71702574],
[ 15.03110867, 6.54001068, 24.53208465],
[ 37.68269495, 26.4411103 , 10.66361816]],
[[ 8.09532373, 12.75333339, 25.79613956],
[ 7.09620297, 2.79257389, 11.15039854],
[ 8.933163 , 19.39985815, 17.14915636]],
[[ 80.00969553, 80.39810464, 76.08184429],
[ 33.27611427, 24.38947838, 39.34919287],
[ 8.89425686, 11.05185138, 10.86767594]]])
3.8.3 Blackbody Spectral Radiance Computation
[ 361. , 6709.60527925],
[ 362. , 6764.82512152],
...
[ 778. , 10606.80038243],
[ 779. , 10590.33272593],
[ 780. , 10573.85196369]],
SpragueInterpolator,
{},
Extrapolator,
{'method': 'Constant', 'left': None, 'right': None})
3.8.4 Dominant, Complementary Wavelength & Colour Purity Computation
xy_n = [0.31270000, 0.32900000]
colour.dominant_wavelength(xy, xy_n)
array([ 0.68354746, 0.31628409]),
array([ 0.68354746, 0.31628409]))
3.8.5 Lightness Computation
'CIE 1976',
'Fairchild 2010',
'Fairchild 2011',
'Glasser 1958',
'Lstar1976',
'Wyszecki 1963']
3.8.6 Luminance Computation
'CIE 1976',
'Fairchild 2010',
'Fairchild 2011',
'Newhall 1943',
'astm2008',
'cie1976']
3.8.7 Whiteness Computation
XYZ_0 = [94.80966767, 100.00000000, 107.30513595]
colour.whiteness(XYZ, XYZ_0)
'Berger 1959',
'CIE 2004',
'Ganz 1979',
'Stensby 1968',
'Taube 1960',
'cie2004']
3.8.8 Yellowness Computation
colour.yellowness(XYZ)
3.8.9 Luminous Flux, Efficiency & Efficacy Computation
colour.luminous_flux(sd)
colour.luminous_efficiency(sd)
colour.luminous_efficacy(sd)
3.9 Contrast Sensitivity Function - colour.contrast
3.10 Colour Difference - colour.difference
Lab_2 = [100.00000000, 426.67945353, 72.39590835]
colour.delta_E(Lab_1, Lab_2)
'CAM02-SCD',
'CAM02-UCS',
'CAM16-LCD',
'CAM16-SCD',
'CAM16-UCS',
'CIE 1976',
'CIE 1994',
'CIE 2000',
'CMC',
'DIN99',
'HyAB',
'HyCH',
'ITP',
'cie1976',
'cie1994',
'cie2000']
3.11 IO - colour.io
3.11.1 Images
RGB.shape
3.11.2 Spectral Images - Fichet et al. (2021)
list(components.keys())
3.11.3 Look Up Table (LUT) Data
print(LUT)
-------------------------------
Dimensions : 2
Domain : [[0 0 0]
[1 1 1]]
Size : (32, 3)
LUT.apply(RGB)
3.12 Colour Models - colour.models
3.12.1 CIE xyY Colourspace
3.12.2 CIE L*a*b* Colourspace
3.12.3 CIE L*u*v* Colourspace
3.12.4 CIE 1960 UCS Colourspace
3.12.5 CIE 1964 U*V*W* Colourspace
colour.XYZ_to_UVW(XYZ)
3.12.6 CAM02-LCD, CAM02-SCD, and CAM02-UCS Colourspaces - Luo, Cui and Li (2006)
XYZ_w = [95.05, 100.00, 108.88]
L_A = 318.31
Y_b = 20.0
surround = colour.VIEWING_CONDITIONS_CIECAM02["Average"]
specification = colour.XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b, surround)
JMh = (specification.J, specification.M, specification.h)
colour.JMh_CIECAM02_to_CAM02UCS(JMh)
XYZ_w = [95.05 / 100, 100.00 / 100, 108.88 / 100]
colour.XYZ_to_CAM02UCS(XYZ, XYZ_w=XYZ_w, L_A=L_A, Y_b=Y_b)
3.12.7 CAM16-LCD, CAM16-SCD, and CAM16-UCS Colourspaces - Li et al. (2017)
XYZ_w = [95.05, 100.00, 108.88]
L_A = 318.31
Y_b = 20.0
surround = colour.VIEWING_CONDITIONS_CAM16["Average"]
specification = colour.XYZ_to_CAM16(XYZ, XYZ_w, L_A, Y_b, surround)
JMh = (specification.J, specification.M, specification.h)
colour.JMh_CAM16_to_CAM16UCS(JMh)
XYZ_w = [95.05 / 100, 100.00 / 100, 108.88 / 100]
colour.XYZ_to_CAM16UCS(XYZ, XYZ_w=XYZ_w, L_A=L_A, Y_b=Y_b)
3.12.8 DIN99 Colourspace and DIN99b, DIN99c, DIN99d Refined Formulas
colour.Lab_to_DIN99(Lab)
3.12.9 ICaCb Colourspace
3.12.10 IgPgTg Colourspace
3.12.11 IPT Colourspace
3.12.12 Jzazbz Colourspace
3.12.13 hdr-CIELAB Colourspace
3.12.14 hdr-IPT Colourspace
3.12.15 Hunter L,a,b Colour Scale
colour.XYZ_to_Hunter_Lab(XYZ)
3.12.16 Hunter Rd,a,b Colour Scale
colour.XYZ_to_Hunter_Rdab(XYZ)
3.12.17 Oklab Colourspace
3.12.18 OSA UCS Colourspace
colour.XYZ_to_OSA_UCS(XYZ)
3.12.19 ProLab Colourspace
3.12.20 Ragoo and Farup (2021) Optimised IPT Colourspace
3.12.21 Yrg Colourspace - Kirk (2019)
3.12.22 Y'CbCr Colour Encoding
3.12.23 YCoCg Colour Encoding
3.12.24 ICtCp Colour Encoding
3.12.25 HSV Colourspace
3.12.26 IHLS Colourspace
3.12.27 Prismatic Colourspace
3.12.28 RGB Colourspace and Transformations
illuminant_XYZ = [0.34570, 0.35850]
illuminant_RGB = [0.31270, 0.32900]
chromatic_adaptation_transform = "Bradford"
matrix_XYZ_to_RGB = [
[3.24062548, -1.53720797, -0.49862860],
[-0.96893071, 1.87575606, 0.04151752],
[0.05571012, -0.20402105, 1.05699594],
]
colour.XYZ_to_RGB(
XYZ,
illuminant_XYZ,
illuminant_RGB,
matrix_XYZ_to_RGB,
chromatic_adaptation_transform,
)
3.12.29 RGB Colourspace Derivation
w = [0.32168, 0.33767]
colour.normalised_primary_matrix(p, w)
[ 3.43966450e-01, 7.28166097e-01, -7.21325464e-02],
[ 0.00000000e+00, 0.00000000e+00, 1.00882518e+00]])
3.12.30 RGB Colourspaces
'ACEScc',
'ACEScct',
'ACEScg',
'ACESproxy',
'ARRI Wide Gamut 3',
'ARRI Wide Gamut 4',
'Adobe RGB (1998)',
'Adobe Wide Gamut RGB',
'Apple RGB',
'Best RGB',
'Beta RGB',
'Blackmagic Wide Gamut',
'CIE RGB',
'CIE XYZ-D65 - Scene-referred',
'Cinema Gamut',
'ColorMatch RGB',
'DCDM XYZ',
'DCI-P3',
'DCI-P3-P',
'DJI D-Gamut',
'DRAGONcolor',
'DRAGONcolor2',
'DaVinci Wide Gamut',
'Display P3',
'Don RGB 4',
'EBU Tech. 3213-E',
'ECI RGB v2',
'ERIMM RGB',
'Ekta Space PS 5',
'F-Gamut',
'F-Gamut C',
'FilmLight E-Gamut',
'Gamma 1.8 Encoded Rec.709',
'Gamma 2.2 Encoded AP1',
'Gamma 2.2 Encoded AdobeRGB',
'Gamma 2.2 Encoded Rec.709',
'ITU-R BT.2020',
'ITU-R BT.470 - 525',
'ITU-R BT.470 - 625',
'ITU-R BT.709',
'ITU-T H.273 - 22 Unspecified',
'ITU-T H.273 - Generic Film',
'Linear AdobeRGB',
'Linear P3-D65',
'Linear Rec.2020',
'Linear Rec.709 (sRGB)',
'Max RGB',
'N-Gamut',
'NTSC (1953)',
'NTSC (1987)',
'P3-D65',
'PLASA ANSI E1.54',
'Pal/Secam',
'ProPhoto RGB',
'Protune Native',
'REDWideGamutRGB',
'REDcolor',
'REDcolor2',
'REDcolor3',
'REDcolor4',
'RIMM RGB',
'ROMM RGB',
'Russell RGB',
'S-Gamut',
'S-Gamut3',
'S-Gamut3.Cine',
'SMPTE 240M',
'SMPTE C',
'Sharp RGB',
'V-Gamut',
'Venice S-Gamut3',
'Venice S-Gamut3.Cine',
'Xtreme RGB',
'aces',
'adobe1998',
'g18_rec709_scene',
'g22_adobergb_scene',
'g22_ap1_scene',
'g22_rec709_scene',
'lin_adobergb_scene',
'lin_ap0_scene',
'lin_ap1_scene',
'lin_ciexyzd65_scene',
'lin_p3d65_scene',
'lin_rec2020_scene',
'lin_rec709_scene',
'prophoto',
'sRGB',
'sRGB Encoded AP1',
'sRGB Encoded P3-D65',
'sRGB Encoded Rec.709 (sRGB)',
'srgb_ap1_scene',
'srgb_p3d65_scene',
'srgb_rec709_scene']
3.12.31 OETFs
'Blackmagic Film Generation 5',
'DaVinci Intermediate',
'ITU-R BT.2020',
'ITU-R BT.2100 HLG',
'ITU-R BT.2100 PQ',
'ITU-R BT.601',
'ITU-R BT.709',
'ITU-T H.273 IEC 61966-2',
'ITU-T H.273 Log',
'ITU-T H.273 Log Sqrt',
'SMPTE 240M']
3.12.32 EOTFs
'DICOM GSDF',
'ITU-R BT.1886',
'ITU-R BT.2100 HLG',
'ITU-R BT.2100 PQ',
'ITU-T H.273 ST.428-1',
'SMPTE 240M',
'ST 2084',
'sRGB']
3.12.33 OOTFs
3.12.34 Log Encoding / Decoding
'ACEScct',
'ACESproxy',
'ARRI LogC3',
'ARRI LogC4',
'Apple Log Profile',
'Canon Log',
'Canon Log 2',
'Canon Log 3',
'Cineon',
'D-Log',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'L-Log',
'Log2',
'Log3G10',
'Log3G12',
'N-Log',
'PLog',
'Panalog',
'Protune',
'REDLog',
'REDLogFilm',
'S-Log',
'S-Log2',
'S-Log3',
'T-Log',
'V-Log',
'ViperLog']
3.12.35 CCTFs Encoding / Decoding
'ACEScct',
'ACESproxy',
'ARIB STD-B67',
'ARRI LogC3',
'ARRI LogC4',
'Apple Log Profile',
'Blackmagic Film Generation 5',
'Canon Log',
'Canon Log 2',
'Canon Log 3',
'Cineon',
'D-Log',
'DCDM',
'DICOM GSDF',
'DaVinci Intermediate',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'Gamma 2.2',
'Gamma 2.4',
'Gamma 2.6',
'ITU-R BT.1886',
'ITU-R BT.2020',
'ITU-R BT.2100 HLG',
'ITU-R BT.2100 PQ',
'ITU-R BT.601',
'ITU-R BT.709',
'ITU-T H.273 IEC 61966-2',
'ITU-T H.273 Log',
'ITU-T H.273 Log Sqrt',
'ITU-T H.273 ST.428-1',
'L-Log',
'Log2',
'Log3G10',
'Log3G12',
'N-Log',
'PLog',
'Panalog',
'ProPhoto RGB',
'Protune',
'REDLog',
'REDLogFilm',
'RIMM RGB',
'ROMM RGB',
'S-Log',
'S-Log2',
'S-Log3',
'SMPTE 240M',
'ST 2084',
'T-Log',
'V-Log',
'ViperLog',
'sRGB']
3.12.36 Recommendation ITU-T H.273 Code points for Video Signal Type Identification
* *
* Colour Primaries: 1 *
* ------------------- *
* *
* Primaries : [[ 0.64 0.33] *
* [ 0.3 0.6 ] *
* [ 0.15 0.06]] *
* Whitepoint : [ 0.3127 0.329 ] *
* Whitepoint Name : D65 *
* NPM : [[ 0.4123908 0.35758434 0.18048079] *
* [ 0.21263901 0.71516868 0.07219232] *
* [ 0.01933082 0.11919478 0.95053215]] *
* NPM -1 : [[ 3.24096994 -1.53738318 -0.49861076] *
* [-0.96924364 1.8759675 0.04155506] *
* [ 0.05563008 -0.20397696 1.05697151]] *
* FFmpeg Constants : ['AVCOL_PRI_BT709', 'BT709'] *
* *
===============================================================================
* *
* Transfer Characteristics: 1 *
* --------------------------- *
* *
* Function :
* FFmpeg Constants : ['AVCOL_TRC_BT709', 'BT709'] *
* *
===============================================================================
* *
* Matrix Coefficients: 1 *
* ---------------------- *
* *
* Matrix Coefficients : [ 0.2126 0.0722] *
* FFmpeg Constants : ['AVCOL_SPC_BT709', 'BT709'] *
* *
===============================================================================
3.13 Colour Notation Systems - colour.notation
3.13.1 Munsell Value
'Ladd 1955',
'McCamy 1987',
'Moon 1943',
'Munsell 1933',
'Priest 1920',
'Saunderson 1944',
'astm2008']
3.13.2 Munsell Colour
3.14 Optical Phenomena - colour.phenomena
[ 3.61000000e+02, 5.53748137e-01],
[ 3.62000000e+02, 5.47344692e-01],
...
[ 7.78000000e+02, 2.37790178e-02],
[ 7.79000000e+02, 2.36559421e-02],
[ 7.80000000e+02, 2.35336632e-02]],
SpragueInterpolator,
{},
Extrapolator,
{'method': 'Constant', 'left': None, 'right': None})
3.15 Light Quality - colour.quality
3.15.1 Colour Fidelity Index
3.15.2 Colour Quality Scale
3.15.3 Colour Rendering Index
3.15.4 Academy Spectral Similarity Index (SSI)
colour.SDS_ILLUMINANTS["C"], colour.SDS_ILLUMINANTS["D65"]
)
3.16 Spectral Up-Sampling & Recovery - colour.recovery
3.16.1 Reflectance Recovery
[ 3.65000000e+02, 8.52203359e-02],
[ 3.70000000e+02, 8.52841304e-02],
...
[ 7.70000000e+02, 4.46546872e-01],
[ 7.75000000e+02, 4.46638451e-01],
[ 7.80000000e+02, 4.46641739e-01]],
SpragueInterpolator,
{},
Extrapolator,
{'method': 'Constant', 'left': None, 'right': None})
3.16.2 Camera RGB Sensitivities Recovery
sensitivities = colour.characterisation.MSDS_CAMERA_SENSITIVITIES["Nikon 5100 (NPL)"]
reflectances = [
sd.copy().align(colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017)
for sd in colour.characterisation.SDS_COLOURCHECKERS["BabelColor Average"].values()
]
reflectances = colour.colorimetry.sds_and_msds_to_msds(reflectances)
RGB = colour.colorimetry.msds_to_XYZ(
reflectances,
method="Integration",
cmfs=sensitivities,
illuminant=illuminant,
k=0.01,
shape=colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017,
)
colour.recovery.RGB_to_msds_camera_sensitivities_Jiang2013(
RGB,
illuminant,
reflectances,
colour.recovery.BASIS_FUNCTIONS_DYER2017,
colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017,
)
-7.64080878e-03],
[ 4.10000000e+02, -8.76715607e-03, 1.12726694e-02,
6.37434190e-03],
[ 4.20000000e+02, 4.58126856e-02, 7.18000418e-02,
4.00001696e-01],
...
[ 6.80000000e+02, 4.00195568e-02, 5.55512389e-03,
1.36794925e-03],
[ 6.90000000e+02, -4.32240535e-03, 2.49731193e-03,
3.80303275e-04],
[ 7.00000000e+02, -6.00395414e-03, 1.54678227e-03,
5.40394352e-04]],
['red', 'green', 'blue'],
SpragueInterpolator,
{},
Extrapolator,
{'method': 'Constant', 'left': None, 'right': None})
3.17 Correlated Colour Temperature Computation Methods - colour.temperature
'Hernandez 1999',
'Kang 2002',
'McCamy 1992',
'daylight',
'hernandez1999',
'kang2002',
'mccamy1992']
3.18 Colour Volume - colour.volume
3.19 Geometry Primitives Generation - colour.geometry
([ 0.5, 0.5, 0. ], [ 1., 1.], [ 0., 0., 1.], [ 1., 1., 0., 1.]),
([-0.5, -0.5, 0. ], [ 0., 0.], [ 0., 0., 1.], [ 0., 0., 0., 1.]),
([ 0.5, -0.5, 0. ], [ 1., 0.], [ 0., 0., 1.], [ 1., 0., 0., 1.])],
dtype=[('position', '
[2, 3],
[3, 1],
[1, 0]], dtype=uint32))
[ 1., 0., 0.],
[ 1., 1., 0.],
[ 0., 1., 0.]])
sorted(colour.PRIMITIVE_VERTICES_METHODS)
['Cube MPL', 'Grid MPL', 'Quad MPL', 'Sphere']
3.20 Plotting - colour.plotting
Most of the objects are available from the colour.plotting namespace:
colour_style()
3.20.1 Visible Spectrum
3.20.2 Spectral Distribution
3.20.3 Blackbody
colour.sd_blackbody(i, colour.SpectralShape(1, 10001, 10))
for i in range(1000, 15000, 1000)
]
plot_multi_sds(
blackbody_sds,
y_label="W / (sr m$^2$) / m",
plot_kwargs={"use_sd_colours": True, "normalise_sd_colours": True},
legend_location="upper right",
bounding_box=(0, 1250, 0, 2.5e6),
)
3.20.4 Colour Matching Functions
"Stockman & Sharpe 2 Degree Cone Fundamentals",
y_label="Sensitivity",
bounding_box=(390, 870, 0, 1.1),
)
3.20.5 Luminous Efficiency
colour.sd_mesopic_luminous_efficiency_function(0.2)
)
plot_multi_sds(
(
sd_mesopic_luminous_efficiency_function,
colour.colorimetry.SDS_LEFS_PHOTOPIC["CIE 1924 Photopic Standard Observer"],
colour.colorimetry.SDS_LEFS_SCOTOPIC["CIE 1951 Scotopic Standard Observer"],
),
y_label="Luminous Efficiency",
legend_location="upper right",
y_tighten=True,
margins=(0, 0, 0, 0.1),
)
3.20.6 Colour Checker
COLOURCHECKER_INDEXES_TO_NAMES_MAPPING,
)
plot_multi_sds(
[
colour.SDS_COLOURCHECKERS["BabelColor Average"][value]
for key, value in sorted(COLOURCHECKER_INDEXES_TO_NAMES_MAPPING.items())
],
plot_kwargs={
"use_sd_colours": True,
},
title=("BabelColor Average - " "Spectral Distributions"),
)
3.20.7 Chromaticities Prediction
3.20.8 Chromaticities
RGB = np.random.random((32, 32, 3))
plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931(
RGB,
"ITU-R BT.709",
colourspaces=["ACEScg", "S-Gamut", "Pointer Gamut"],
)
3.20.9 Colour Rendering Index Bars
3.20.10 ANSI/IES TM-30-18 Colour Rendition Report
3.20.11 Gamut Section
3.20.12 Colour Temperature
4 User Guide
4.1 Installation
Colour and its primary dependencies can be easily installed from the Python Package Index by issuing this command in a shell:
The detailed installation procedure for the secondary dependencies is described in the Installation Guide.
Colour is also available for Anaconda from Continuum Analytics via conda-forge:
4.2 Tutorial
The static tutorial provides an introduction to Colour. An interactive version is available via Google Colab.
4.3 How-To
The Google Colab How-To guide for Colour shows various techniques to solve specific problems and highlights some interesting use cases.
4.4 Contributing
If you would like to contribute to Colour, please refer to the following Contributing guide.
4.5 Changes
The changes are viewable on the Releases page.
4.6 Bibliography
The bibliography is available on the Bibliography page.
It is also viewable directly from the repository in BibTeX format.
5 API Reference
The main technical reference for Colour is the API Reference:
6 See Also
6.1 Software
Python
- ColorAide by Muse, I.
- ColorPy by Kness, M.
- Colorspacious by Smith, N. J., et al.
- python-colormath by Taylor, G., et al.
Go
- go-colorful by Beyer, L., et al.
.NET
- Colourful by Pazourek, T., et al.
Julia
- Colors.jl by Holy, T., et al.
Matlab & Octave
- COLORLAB by Malo, J., et al.
- Psychtoolbox by Brainard, D., et al.
- The Munsell and Kubelka-Munk Toolbox by Centore, P.
7 Code of Conduct
The Code of Conduct, adapted from the Contributor Covenant 1.4, is available on the Code of Conduct page.
8 Contact & Social
The Colour Developers can be reached via different means: