swaywm / swaylock

Screen locker for Wayland
MIT License
850 stars 200 forks source link

Allow 3- and 4-digit hex colors #352

Open milkey-mouse opened 7 months ago

milkey-mouse commented 7 months ago

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.