Lost deep in a color well

So, I figured out how to code changing the color of a color well ” an amazing feat in itself given my confusion with this language. But it doesn’t’ work quite like it should so I must be making an error.

property refUIEditColorTextColor : missing value -- connected to the color well on the interface

log {r,g,b}
-- result = {191,38,0}
set recColor to NSColor's colorWithCalibratedRed_green_blue_alpha_(r,g,b,1)
tell refUIEditColorTextColor to setColor_(recColor)

The good news is that this DOES change the color of the well… The bad news is that it makes it a yellowish color and if I set the sliders in directly in the interface to 191, 38, 0 it is a reddish color.

What might cause this mis-coloration?

Oddly sending 102, 204, 0 results in the same yellow color…


the values of the colorWithCalibratedRed:green:blue:alpha: method are specified as float values between 0.0 and 1.0
unlike the AppleScript RGB color type which takes integer values between 0 and 65535


My RGB numbers {191, 38, 0} when converted for AS Studio were {48896, 9728, 0}. I divided each by 65535 and that gave me the colors I expected.


I recommend to read always the documentation for the used methods especially the discussion section

Yeah… I overlooked that comment when reviewing. Very overwhelmed still trying to remap by brain to this language. Thanks for the tip though, discussion section holds good info!