Hi folks,

I was playing with using the OPEN COLOR PICKER command for the first time.
Reasonably cool feature that really is only missing a way to close the
window programmatically and get the selected value directly. But it's way
better than the rgb sliders we had to use for years.

I used a modified version of the approach detailed in this tech tip
<http://kb.4d.com/assetid=77740>. The process is to have an obscure text
area on your form, open the color picker for it to set the background color
and then use OBJECT GET RGB COLORS to get that color since you can't
capture the picked color value directly.

All seemed well and I had a nice display of the selected color and its hex
string. Until I clicked over to the listing of web safe colors in the
picker. The thing is each of those colors lists its hex value and the hex
string I calculated was not the same. Sometimes really off.

For example, hex color selected  -->  color reported:

red: #FF0000 ( or 0x00FF0000 in 4D) --> #FF2600
'burnt orange': #FF6600 --> #FF7C00

light gray: #CCCCCC  -->  #D6D6D6

black and white are correctly reported

My first suspicion was the function to string the RGB color to hex. But
this is just the String function. I also wondered if my Hex to longint
function might be wrong even though it's not being used. It's one of the 3
examples of how to do that on the KB and they all give the same answer (but
probably vary in the time they take).

So that leaves a couple of possibilities:

   1. the color returned by OPEN COLOR PICKER is not exactly the value
   2. the color set by OPEN COLOR PICKER is not exactly the value selected

I can't determine which because I can't know the actual value the color
picker is installing in the form object. I do know that OBJECT SET RGB
COLOR is consistent with OBJECT GET RGB COLORS because if I set and
retrieve a value they are the same. So I think these two methods do what
they say they do.

When I set the object color from the hex string and drag the color picker
over the form area the differences look more pronounced on dark colors. But
trying to quantify these sort of differences without a colorimeter is not

Anyone else seen this? Any ideas? Worth filing a bug report?

‚ÄčThis is v16.2 (32 bit) on macos Sierra. ‚Äč

Kirk Brooks
San Francisco, CA

*The only thing necessary for the triumph of evil is for good men to do

*- Edmund Burke*
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com

Reply via email to