janet-lang / jaylib

Janet bindings to Raylib
MIT License
137 stars 36 forks source link

jaylib_getcolor hex abgr -> rgba #31

Closed saikyun closed 2 years ago

saikyun commented 2 years ago

After doing some testing, it seems that jaylib_getcolor has the format of abgr.

bakpakin said

I don't think that color order is abrg if I recall. I think I intentionally chose whatever raylib used, or simply picked something that made sense with hexcodes. If not, I don't recall why I set it up the way I did.

When trying with raylib, I got:

printf("%x\n", ColorToInt((Color){128, 64, 0, 255}));
// prints:
804000ff

Which implies it uses rgba. When looking at the Color struct, the order is rgba (https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c#L81-L87), and when I tried rendering text with color (Color){255, 0, 0, 255} it was red.

In addition to following raylib, using rgba makes it easier to copy hex colors from other tools like image editors.

Therefore I suggest that we change jaylib's jaylib_getcolor to rgba.