Skip to content

Commit f86cfb2

Browse files
committed
Add ability to control gamut mapping space in harmony diagram
1 parent 98411f8 commit f86cfb2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/harmony_diagram.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def plot_slice(
108108
gamut='srgb',
109109
gmap=None,
110110
res=500,
111-
scatter_size=16
111+
scatter_size=16,
112+
pspace=None
112113
):
113114
"""Plot a slice."""
114115

@@ -120,7 +121,8 @@ def plot_slice(
120121
hue, chroma, lightness = cs.names()
121122
else:
122123
lightness, chroma, hue = cs.names()
123-
pspace = cs.NAME
124+
if pspace is None:
125+
pspace = cs.NAME
124126

125127
# Interpolate between each x axis color along the y axis
126128
cmap = []
@@ -163,6 +165,7 @@ def main():
163165
parser.add_argument('--max-chroma', '-M', help="Maximum chroma.")
164166
parser.add_argument('--harmony', '-n', default='', help="Color harmony to use.")
165167
parser.add_argument('--gamut', '-g', default="srgb", help='Gamut to evaluate the color in (default is sRGB).')
168+
parser.add_argument('--pspace', '-p', help="Specific perceptual space to gamut map in.")
166169
parser.add_argument('--map-colors', '-m', action='store_true', help="Gamut map colors to be within the gamut.")
167170
parser.add_argument('--gamut-map-method', '-f', default="raytrace", help="Gamut mapping space.")
168171
parser.add_argument('--title', '-t', default='', help="Provide a title for the diagram.")
@@ -224,7 +227,8 @@ def main():
224227
gamut=args.gamut,
225228
gmap=gmap,
226229
res=args.resolution,
227-
scatter_size=int(args.scatter_size)
230+
scatter_size=int(args.scatter_size),
231+
pspace=args.pspace if args.pspace else None
228232
)
229233

230234
if args.harmony:

0 commit comments

Comments
 (0)