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

Add color opacity for safelist with regex #7582

Closed
wants to merge 1 commit into from
Closed

Add color opacity for safelist with regex #7582

wants to merge 1 commit into from

Conversation

mrinx
Copy link
Contributor

@mrinx mrinx commented Feb 22, 2022

The pattern-based safelisting currently doesn't support colors with opacity (#6770).

This pull request is trying to solve that by adding opacities option in addition to variants.

@adamwathan
Copy link
Member

Hey! I think this is a good idea in principle and it's something we talked about before the v3 launch but ultimately decided to skip it because it felt like the API was getting a bit messy and we couldn't decide on a good name for the option.

Thinking about it more though I had this idea for supporting this that I think I like a lot better:

safelist: [
  {
    pattern: [['hover'], /bg-(red)-(100|200)/, ['50']]
  },
],

Basically a tuple where the positions of the different "parts" map to the utility classes using the same overall shape. Then we could deprecate the variants option as well, and maybe even deprecate this entire object syntax thing and just support doing this at the top-level:

safelist: [
  'bg-black',
  /pt-.+/,
  [['hover', 'focus'], /bg-(red)-(100|200)/].
  [['hover', 'focus'], /bg-(blue)-(100|200)/, ['50', '75]],
],

I'm going to close this as I don't want to move forward with this approach and would rather try something like what I've outlined above (while keeping support for what's there currently just for backwards compatibility).

If you wanted to work on a PR for something like what I've described I'd be happy to look at that again but of course no pressure, up to you!

Thanks for the PR regardless, appreciate the contribution and sorry to say no ❤️

@adamwathan adamwathan closed this Feb 25, 2022
@mrinx
Copy link
Contributor Author

mrinx commented Feb 25, 2022

Hey! Thank you for the feedback and suggestions, no hard feelings :)

I'll give the PR you outlined a try 🙂

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

Successfully merging this pull request may close these issues.

None yet

2 participants