Question: Difficulties in using the ColorTools package

Hi everybody,

This is a notional example.
I create a variable MyColor of type string, which contains some correct specification of a known color.
Two examples are
    MyColor := "CSS Red";            
    MyColor := "Resene LaRioja":

In the ColorTools package there exist a few couples of (a priori) reciprocal functions, for instance NameToRGB24 and RGB24ToName.
So I can expect that composing one of this function with its reciprocal is a neutral operation.

But, if I apply first  NameToRGB24 to a well formed MyColor color and next thits reciprocal RGB24ToName , I do not recover MyColor ... or at least not all the time

Example 1 : 
MyColor := "CSS Red";    
RGB24ToName ( NameToRGB24 (MyColor) ); 

Let us observe the loss of the palette name ...

Example 2 : 
MyColor := "Resene LaRioja";    
NameToRGB24 (MyColor) ); 
      [179, 193, 16]
RGB24ToName ( % ); 
     error, (in ColorTools) unknown RGB color [179, 193, 16]

It seems that RGB24ToName ( NameToRGB24 (MyColor) ); works correctly only if MyColor refers to a color from palette CSS. This seems consisttent with the loss of the palette name in example 1 and the presence of the word RGB (and not RGB24) in this error message.
More generally, for colors from other palettes than CSS the same kind of error is returned (I did not do intensive testing ...)

Is this an error,
   or some limitation I missed,
      or an improper use of RGB24ToName ?

I look forward to your response




Please Wait...