Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missusage of Sass rgba global function #159

Merged
merged 2 commits into from Feb 24, 2022
Merged

Fix missusage of Sass rgba global function #159

merged 2 commits into from Feb 24, 2022

Conversation

dgdavid
Copy link
Member

@dgdavid dgdavid commented Feb 24, 2022

The value used for the alpha channel in the global rgba Sass function is wrong, which ends up producing the rgb color instead.

According to the documentation

The alpha channel can be specified as either a unitless number between
0 and 1 (inclusive), or a percentage between 0% and 100% (inclusive)

To fix it, we can either: add the missing % or change the value to its equivalent unitless number between 0 and 1. The first option was chosen.

But using a good value does not work either because it produces a CSS rgba function with a unitless alpha value. I.e., both rgba(255, 255, 255, 0.6) and rgba(255, 255, 255, 60%) Sass built-in functions produce rgba(255, 255, 255, 0.6) CSS function.

However, as @lslezak mentioned in IRC channel, Qt expect a percentage between 0 and 100 for the alpha channel value in the rgba function. A complete mess 🤷‍♂️

So, the (poor man) solution is to interpolate the full rgba function to produce the value expected for Qt. Maybe we could create a Sass user function to do so, but for now it is enough as it is.

Tests (updated with the latest fix)

Tested manually in the first screen of the installer, which holds a disabled Back QPushButton.

It works.

Screenshots (updated with the latest fix)

Name Screenshot
Dark dark
Light light
Cyan - Black cyan
White - Black bw
High contrast highcontrast png

The alpha channel was using a percentage without the "%" symbol, which
was producing the rgb color instead.

See https://sass-lang.com/documentation/modules#rgb

> The alpha channel can be specified as either a unitless number between
> 0 and 1 (inclusive), or a percentage between 0% and 100% (inclusive)
@dgdavid dgdavid requested a review from lslezak February 24, 2022 15:01
Because it produces a CSS rgba function not fully compatible with Qt
rgba function, which expect the alpha channel in a percentaje value
between 0 and 100, instead of a unitless one between 0 and 1.

https://doc.qt.io/qt-5/stylesheet-reference.html
@lslezak lslezak merged commit 4561c6f into scss Feb 24, 2022
@lslezak lslezak deleted the fix-rgba-use branch February 24, 2022 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants