Is there a way to get the cmyk values from the cmyk sliders of a color well?
Is there a way to make the default screen of a color well be set the cmyk sliders panel?
Basically, I want the user to pick a color as cmyk.
The other idea I had was to make my own sliders in my window, four total, one for each c, m, y & k. I just can’t figure out how to have a visual representation of the color as the user builds it (a color swatch that changes dynamically with the sliders).
Any thoughts would be greatly appreciated,
CarbonQuark
add a color well “cv” and four sliders “c”,“m”,“y”,“k” to your nib
connect the color well to ‘awake from nib’
set the sliders value range from 0.0 - 1.0 and check ‘Continuously send …’
connect the sliders to the action handler
and here’s the script:
property colorValues : {c:0, m:0, y:0, k:0, a:1}
on awake from nib theObject
my setCMYKColor(color well "cv" of window "main")
end awake from nib
on action theObject
set col to (name of theObject)
set val to (float value of theObject)
if col is "c" then
set c of colorValues to val
else if col is "m" then
set m of colorValues to val
else if col is "y" then
set y of colorValues to val
else if col is "k" then
set k of colorValues to val
end if
my setCMYKColor(color well "cv" of window "main")
end action
on setCMYKColor(theWell)
set color of theWell to (call method "colorWithDeviceCyan:magenta:yellow:black:alpha:" of class "NSColor" with parameters (colorValues as list))
end setCMYKColor
If you prefer % values then you have to add some maths to convert the % values to the NSColor’s value range (float 0.0 - 1.0)