color lib

Andrea Fontana via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 10 06:41:59 PDT 2016


On Monday, 10 October 2016 at 13:25:07 UTC, Manu wrote:
> On 10 October 2016 at 23:00, Andrea Fontana via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>> On Monday, 10 October 2016 at 08:44:49 UTC, Manu wrote:
>>
>> From doc:
>> colorFromString Create a color from a string. May be a hex 
>> color in the
>> standard forms: (#/$)rgb/argb/rrggbb/aarrggbb May also be the 
>> name of any
>> color from the Colors enum.
>>
>> It seems it reads just rgb. (+ enum)
>>
>> I think that:
>> colorFromString("red");
>> colorFromString!"rgb"("#3212ff");
>> colorFromString!"bgra"("#ff1232dd");
>>
>> makes more sense.
>>
>> Andrea
>
> Why? I see no value in that function being a template... It's 
> not like you can confuse "#FF0080" and "LightGoldenrodYellow". 
> As far as I know, there's no possible ambiguity in colour 
> strings, so why make them separate functions?

But it would be useful to create rgb, bgr, argb, bgra, or other 
color space using a string.

If a third party library or source gives me code in rgba, I have 
to preprocess it to convert as argb and then pass it to your 
library.

Anyway, I don't know if a code with letters a-f can be composed. 
In that case an ambiguity exists.


More information about the Digitalmars-d mailing list