JuliaGraphics / Colors.jl

Color manipulation utilities for Julia
Other
200 stars 44 forks source link

BGR interpreted as RGB #532

Closed tawheeler closed 1 year ago

tawheeler commented 1 year ago

Maybe I'm missing something, but the following behavior for BGR was unexpected:

> c = RGB(0.0, 0.5, 1.0); c.r
0.0
> d = BGR(0.0, 0.5, 1.0); d.r
0.0

I would have expected BGR to set its red channel to 1.0, but it appears to also be using the RGB ordering.

timholy commented 1 year ago

See the bold text in https://github.com/JuliaGraphics/ColorTypes.jl#rgb-plus-bgr-xrgb-rgbx-and-rgb24-the-abstractrgb-group. This is a debatable design decision but it allows generic programming without needing to know or care about the specific memory layout.