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

Support for unitless hsl values in Sass #140

Open
arusahni opened this issue Nov 4, 2020 · 3 comments · May be fixed by #187
Open

Support for unitless hsl values in Sass #140

arusahni opened this issue Nov 4, 2020 · 3 comments · May be fixed by #187
Labels

Comments

@arusahni
Copy link

arusahni commented Nov 4, 2020

First off, thanks for the plugin! It's one of the few that I never really have to worry about breaking on me.

Unfortunately, I've hit a (fun?) edge case that I think could at least be better handled. Sass allows for unitless hsla() or hsl(), e.g.:

div {
    color: hsla(149,28,76,1);
}

When css-color encounters the unitless invocation, an error message is raised:

Error detected while processing function <SNR>145_parse_screen[4]..<SNR>145_create_syn_match:
line   20:
E605: Exception not caught: css_color: create_syn_match invoked on bad match data

In an ideal world, this plugin would be able to treat the unitless variant the same as the version with units. However, the unitless variant is not valid CSS, so that may pose a challenge. At the very least, would it be possible to suppress the error? Having the entire UI block until I dismiss a message can be cumbersome.

@ap
Copy link
Owner

ap commented Nov 23, 2020

Glad you enjoy it 🙂 And I deeply appreciate getting this particular praise – not making users jump through hoops for mere convenience on my part without real benefit to them is one of the values I hold highly, which seems to be eroding everywhere else. (Also sorry I took so long to get back to you!)

It definitely shouldn’t raise this error and it should indeed support the unitless version if possible. I’ll take a look.

@ap ap added the bug label Nov 23, 2020
@Aster89
Copy link

Aster89 commented Oct 21, 2021

Hi, I've hit the same "bug" and it is very annoying when one is picking colors from some online source, for instance.

To give an example, I have a lot of variables holding colors defined in HEX, which is a bit inconventient when one wants to change just hue, or just the lightness, ... So I'm converting them to HLS using this online converter, which however gives me the value swithout the % signs on lightness and saturation, so when I paste e.e. hsl(224,13,34) in Vim, I get a first error; then when I add % to either 13 or 34 I get another error because I've have corrected only one of them.

@adamhotep
Copy link

Dang, I was looking for this when I put in the format-vetting in my fork. I don't know anything about SASS/SCSS, and wasn't able to find it in the docs from a quick glance. I'll have to revisit this.

adamhotep added a commit to adamhotep/vim-css-color that referenced this issue May 30, 2023
Support non-percent saturation/luminance & whiteness/blackness in SASS and SCSS but prevent them in standard CSS
@adamhotep adamhotep linked a pull request May 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants