On 11 October 2016 at 18:10, Andrea Fontana via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > 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
Oh dear... thanks for digging that up. I didn't know the web had a standard for alpha. Certainly 0xAARRGGBB has been used in windows code for as long as I've been programming... but now there's a competing #RRGGBBAA version... How to resolve this? I guess, go with the web? I should probably change it to the CSS4 way.