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

Allow 3-digit hex colors #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

milkey-mouse
Copy link

These are common enough (especially on the web) that a new user might try to use a 3-digit hex color such as #f00. We might as well make this work and save a few seconds of confusion/RTFM.

See also swaywm/swaylock#352.

These are common enough (especially on the web) that a new user might
try to use a 3-digit hex color such as #f00. We might as well make this
work and save a few seconds of confusion/RTFM.
@mstoeckl
Copy link
Collaborator

mstoeckl commented Apr 15, 2024

I (only part of swaybg, not swaylock or the other repositories) am ambivalent. I do think that color formats should be consistent between swaynag, swaylock, swaybar, swaybg, and sway itself, which does raise the bar for this PR since the benefit of this change should be worth making and maintaining edits to code and documentation in all of these projects.

Notes:

  • Having a standardized color format is rather valuable; currently you can copy RRGGBB values around between various scripts and config files without having to change formats. Because people want to copy/paste color values around, color pickers (like kcolorchooser, hyprpicker, xcolor, plus various websites) give the 6-digit hex colors by default.
  • I haven't seen 3-digit hex colors be used anywhere outside CSS (which has many ways to represent a color), although admittedly they do get used a lot there; they are a bit more convenient to type when I only want an approximate color.

We might as well make this work and save a few seconds of confusion/RTFM.

I opened #67, which should document the color requirement a bit better.

@milkey-mouse
Copy link
Author

milkey-mouse commented Apr 27, 2024

I have changes ready to go for the other sway* projects, as I agree consistency between them would be important. (In fact this change to swaybg isn't too useful until sway itself can parse 3-digit colors for an output's background.) But I see what you mean how across projects it might be better to hold the line at 6 digits.

I don't see many third-party scripts programmatically parsing sway config files, though, so the only case in which this would matter is interactive copy-pasting. I know of a couple other desktop programs that support 3-digit hex colors already such as conky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants