color lib
Andrea Fontana via Digitalmars-d
digitalmars-d at puremagic.com
Tue Oct 11 01:10:56 PDT 2016
On Monday, 10 October 2016 at 23:26:53 UTC, Manu wrote:
> I'm not sure why it matters what format the colour you have
> is...
> Strings are in the form #RRGGBB, or #AARRGGBB. That is all.
> It's the standard I've seen used everywhere ever, including the
> web,
> which is a pretty good precedent :P
If the web is a good precedent (CSS4 specs):
"The first 6 digits are interpreted identically to the 6-digit
notation. The last pair of digits, interpreted as a hexadecimal
number, specifies the alpha channel of the color, where 00
represents a fully transparent color and ff represent a fully
opaque color."
https://drafts.csswg.org/css-color/#hex-notation
CSS3 doesn't support hex string with alpha but they suggest you
to use rgba() function. I think argb() doesn't exists instead.
https://www.w3.org/TR/2011/REC-css3-color-20110607/#rgba-color
Chrome 52 supports it:
https://googlechrome.github.io/samples/css-alpha-channel/
Android instead:
https://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String)
"Parse the color string, and return the corresponding color-int.
If the string cannot be parsed, throws an
IllegalArgumentException exception. Supported formats are:
#RRGGBB #AARRGGBB [...]"
Please notice that on PNG file format rgba is quite common (also
on bmp with semi-official apha support)
PNG: http://www.libpng.org/pub/png/book/chapter08.html
More information about the Digitalmars-d
mailing list