buggins / dlangui

Cross Platform GUI for D programming language
Boost Software License 1.0
805 stars 120 forks source link

Why ARGB and not RGBA? #653

Closed bagomot closed 1 year ago

bagomot commented 1 year ago

https://github.com/buggins/dlangui/blob/51d1eabb8d9b1265f3253d518c742db51f5cbf5f/src/dlangui/graphics/colors.d#L316 Almost everywhere, and even more so in css engines, RGBA is used, it is extremely inconvenient to use ARGB when it is so rare.

GrimMaple commented 1 year ago

I'm not the author of this code, but I assume it has something to do with endianess (it always is). If you want, you can add decodeHexColorRGBA and I will happily merge :)

bagomot commented 1 year ago

I did not find a way to distinguish RGBA from ARGB in hex form. If only to parse a string like rgba(r,g,b,a).

GrimMaple commented 1 year ago

Well, as unfortunate as it is right now, switching from ARGB to RGBA will cause breakage. And a lot of breakage. I don't see how this could be changed without breaking everything already written.

I will try to investigate how much actual damage that might cause. If it doesn't do too much, maybe RGBA can be used.

GrimMaple commented 1 year ago

On a sidenote, I will probably deprecate the function all together, and then make parseCSSColor instead, to avoid any confusion

GrimMaple commented 1 year ago

I added parseCSSColor function, but I couldn't deprecate the parseHexColor. Dlangui relies on ARGB too much internally so it's not viable to change everything right now.