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

fix(color)!: keep hsla and rgba consistent with tailwindcss #3221

Merged
merged 7 commits into from Oct 23, 2023

Conversation

Simon-He95
Copy link
Contributor

@Simon-He95 Simon-He95 commented Oct 11, 2023

@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f1bb5e2
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/6533d0923af9100008c6e295
😎 Deploy Preview https://deploy-preview-3221--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@chu121su12
Copy link
Collaborator

Theres more to update. Please see https://github.com/chu121su12/unocss/tree/space-color-syntax

@antfu antfu changed the title chore(color): keep hsla and rgba consistent with tailwindcss fix(color): keep hsla and rgba consistent with tailwindcss Oct 11, 2023
@Simon-He95
Copy link
Contributor Author

if (['hsla', 'hsl', 'rgba', 'rgb'].includes(type))
return `${type.replace('a', '')}a(${components.join(',')}${alpha == null ? '' : `,${alpha}`})`
if (['hsla', 'rgba'].includes(type))
return `${type}(${components.join(' ')}${alpha == null ? '' : ` / ${alpha}`})`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we clearly agreed that we are going to align with Tailwind, I think this should use COMMA-SEPARATED syntax instead of SPACE-SEPARATED syntax.

Tailwind uses SPACE for rgb and hsl, but COMMA for rgba and hsla.

I can see that through out the MR we are changing everything to SPACE syntax, as well as rgba and hsla. This will work in the browser but that's not aligned with Tailwind.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break for those who uses COMMA syntax with rgba and hsla (It makes sense to use legacy color function with legacy syntax? 🤣)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood it at first. I used tailwind play to check the output results and made adjustments.

packages/rule-utils/src/colors.ts Show resolved Hide resolved
packages/rule-utils/src/colors.ts Outdated Show resolved Hide resolved
packages/preset-mini/src/_rules/ring.ts Outdated Show resolved Hide resolved
@antfu antfu changed the title fix(color): keep hsla and rgba consistent with tailwindcss fix(color)!: keep hsla and rgba consistent with tailwindcss Oct 23, 2023
@antfu antfu merged commit 5c3d02d into unocss:main Oct 23, 2023
9 checks passed
@Simon-He95 Simon-He95 deleted the hsl branch October 23, 2023 02:36
justmoon added a commit to justmoon/dassie that referenced this pull request Nov 7, 2023
UnoCSS used to differ from Tailwind which required us to have a different format for our color variables. This is no longer the case, so we can use the regular Tailwind color variables.

See: unocss/unocss#3221
@shellscape
Copy link

@antfu @Simon-He95 Gmail explicitly doesn't support space separated color function values, so when using uno tomgenerate cas for HTML used in email, we get undesirable rendering. What's the solution (if any) tomrevert to comma separated?

timozander added a commit to timozander/unocss that referenced this pull request Dec 31, 2023
@antfu antfu mentioned this pull request Jan 1, 2024
2 tasks
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.

[🐞color]: hsl and rgb is opinionated to the legacy comma-separated syntax
5 participants