francma / wob

A lightweight overlay volume/backlight/progress/anything bar for Wayland.
ISC License
911 stars 50 forks source link

fix: parse rgba correctly #81

Closed boredland closed 3 years ago

boredland commented 3 years ago

apparently I did not test this properly and introduced an error parsing the rgba value while cherry-picking

boredland commented 3 years ago

hm.. i think its still not working 100% as it should:

wob --border-color "#16a085FF" --bar-color "#16a085FF" --background-color '#000000FF'

renders the wob black on black for me, while everything works nicely with red:

wob --border-color "#FF0000FF" --bar-color "#FF0000FF" --background-color '#000000FF'

boredland commented 3 years ago

added a test with printing the values and it confirms my comment from earlier. while the red value is saved correctly, the green-ish value is just black. any ideas as to why @francma ?

francma commented 3 years ago

Looks like I've broken it in https://github.com/francma/wob/commit/6b1db6c2bd169cc2e231f3d2558b1dde8e5454c2#diff-8d4a2f7af9d0296ddf4f7d8c6af88631fe880014944ec713512585530ee1f853R10.

It should look like this to have correct operator precedence.

    uint8_t alpha = (uint8_t) (color.a * UINT8_MAX);
    uint8_t red = (uint8_t) (color.r * UINT8_MAX);
    uint8_t green = (uint8_t) (color.g * UINT8_MAX);
    uint8_t blue = (uint8_t) (color.b * UINT8_MAX);

Can you please make this change as part of this PR?

boredland commented 3 years ago

have you got an idea why the clang-format test fails? when I run clang-format *.c tests/*.c --output-replacements-xml | (! grep "</replacement>" 1>/dev/null) locally, it exits with 0

francma commented 3 years ago

Probably clang version mismatch - pipeline has clang 10 vs clang 11 on our local machines. I've updated pipeline to clang 11 so it will hopefully work after rebase from master.

boredland commented 3 years ago

ya, worked! tyvm!