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

Feature/tailwind v4 update #741

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Roene-JustBetter
Copy link
Member

WIP - Tailwind update to version 4.

@Roene-JustBetter Roene-JustBetter marked this pull request as draft February 25, 2025 07:27
function color(variable, fallback) {
return 'color-mix(in srgb, var(' + variable + ', ' + fallback + ') calc(100% * <alpha-value>), transparent)'
}

export default {
content: [
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried using the @source in the app.css inside the Rapidez/core But I didn't managed to load styling from other vendor packages like rapidez/menu or rapidez/account.

--color-conversion: color-mix(in srgb, var(--conversion, #22c55e) calc(100% * 1), transparent);
--color-conversion-text: color-mix(in srgb, var(--conversion-text, #fff) calc(100% * 1), transparent);
--color-foreground-emphasis: color-mix(in srgb, var(--foreground-emphasis, #0f172a) calc(100% * 1), transparent);
--color-foreground: color-mix(in srgb, var(--foreground, #1e293b) calc(100% * 1), transparent);
Copy link
Member

@royduin royduin Feb 25, 2025

Choose a reason for hiding this comment

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

As per: https://tailwindcss.com/docs/colors#referencing-in-css and previously within the tailwind.config.js we can reference existing colors;

--color-foreground: color-mix(in srgb, var(--foreground, var(--color-slate-800)) calc(100% * 1), transparent);

Demo: https://play.tailwindcss.com/QB164GxvSS


Seems like we don't need the color-mix(), Tailwind is handeling that for us now

--color-foreground: var(--foreground, var(--color-slate-800));

Demo: https://play.tailwindcss.com/yslYTQCdL6?file=css


But... with this it's a bit weird to have --color-foreground and --foreground, maybe change everything to be inline with Tailwind, so prefix all colors and only use --color-foreground

Demo: https://play.tailwindcss.com/IUMpQQ8KCa?file=css


Another update; undocumented but it's still possible to scope colors to utilities:

--foreground: var(--color-slate-800);
--text-color-default: var(--foreground);

This way bg-foreground doesn't work, as it should.

Demo: https://play.tailwindcss.com/kwKsPPfh8q?file=css

Comment on lines +92 to +100
@utility text {
color: var(--text-color);
}
@utility text-emphasis {
color: var(--text-color-emphasis);
}
@utility text-muted {
color: var(--text-color-muted);
}
Copy link
Member

Choose a reason for hiding this comment

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

With the scoped colors we don't need this, only text doesn't work by default so that one should stay. But... it doesn't support the opacity modifier (eg text/50), see: tailwindlabs/tailwindcss#16824

For the time being, the "full version" does support it: text-default/50

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.

2 participants