-
Notifications
You must be signed in to change notification settings - Fork 279
Support alpha in hexadecimal colors #3052
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
Conversation
d0b078e
to
83e8167
Compare
webapp/src/Utils/Utils.php
Outdated
*/ | ||
public static function parseHexColor(string $hex): array | ||
{ | ||
// Ignore alpha in hexstrings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why silently ignore the alpha channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might indeed a bit harsh to do this silently. Do we ever think we need the alpha channel? Otherwise I think I'll add a optional boolean for this behaviour (optionally also returning rgba
instead of rgb
), alternative is to check all calling functions and handle this there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unlikely that we need it. But I'm either for supporting it properly or not allowing it at all to avoid user confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec allows for sending such a string "#ff00ffaa" so we need to store it. I think my fix already makes that we never pick it up but I'll think about this some more. Maybe just supporting it is easier in that case.
5369d0c
to
f4e085c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next to my minor comment, there are some phpcs errors left to fix. Otherwise good to merge.
d4e80ec
to
c5bc5f1
Compare
No functional change intended.
And add some more testing for those to also check for DOMjudge#123 format. The functions using the strings have moved from the TwigExtension to utils as the they don't really depend on Twig itself. This makes testing easier and can use this in the future for other elements. Co-authored-by: Tobias Werth <[email protected]>
The contest validation breaks when the contestproblem has an invalid color PC^2 doesn't check the colors as they don't need them so mistakes in the problemset.yaml would also be fed to the feed.
be42623
to
333dc41
Compare
This is as a basis to detect problematic colors coming from the primary.
I can't think of any place where any consumer would ever want to display the colors with some opacity. So I wonder if it's intentional that the spec links to a document which has this.