Implement suport for blending chromaticity diagrams colours.
@@ -28,8 +28,8 @@ from colour.models import (Luv_to_uv, Luv_uv_to_xy, UCS_to_uv, UCS_uv_to_xy,
from colour.plotting import (
DEFAULT_FIGURE_WIDTH, DEFAULT_PLOTTING_COLOURSPACE,
XYZ_to_plotting_colourspace, canvas, get_cmfs, render)
-from colour.utilities import (is_string, normalise_maximum, suppress_warnings,
- tstack)
+from colour.utilities import (is_string, lerp, normalise_maximum,
+ suppress_warnings, tstack)
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2013-2018 - Colour Developers'
@@ -201,6 +201,8 @@ def chromaticity_diagram_colours_plot(
samples=256,
cmfs='CIE 1931 2 Degree Standard Observer',
method='CIE 1931',
+ blend_colour=None,
+ blend_amount=0.5,
**kwargs):
"""
Plots the *Chromaticity Diagram* colours according to given method.
@@ -215,6 +217,10 @@ def chromaticity_diagram_colours_plot(
method : unicode, optional
**{'CIE 1931', 'CIE 1960 UCS', 'CIE 1976 UCS'}**,
*Chromaticity Diagram* method.
+ blend_colour : array_like, optional
+ Colour to blend the *Chromaticity Diagram* colours with.
+ blend_amount : numeric or array_like, optional
+ Amount of blending.
Other Parameters
----------------
@@ -270,6 +276,9 @@ def chromaticity_diagram_colours_plot(
RGB = normalise_maximum(
XYZ_to_plotting_colourspace(XYZ, illuminant), axis=-1)
+ if blend_colour is not None:
+ RGB = lerp(RGB, blend_colour, blend_amount)
+
polygon = Polygon(spectral_locus, facecolor='none', edgecolor='none')
axes.add_patch(polygon)
# Preventing bounding box related issues as per
