Allow 3- and 4-digit hex colors - #352
Open
twilligon wants to merge 1 commit into
Open
Conversation
These are common enough (especially on the web) that a new user might try to use a 3-digit hex color such as #f00 (or one with transparency such as #f008). We might as well make this work and save a few seconds of confusion/RTFM.
WhyNotHugo
reviewed
Aug 5, 2025
| } | ||
| return res; | ||
|
|
||
| swaylock_log(LOG_DEBUG, "Invalid color %s, defaulting to 0xFFFFFFFF", color); |
Contributor
There was a problem hiding this comment.
Nitpick: this should probably be a warning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are common enough (especially on the web) that a new user might try to use a 3-digit hex color such as
#f00(or one with transparency such as#f008). We might as well make this work and save a few seconds of confusion/RTFM.Also, print the "Invalid color" message if the color string is of an allowed length, but not parseable as a hex color (example:
#bruh). No reason to be as lenient as HTML.