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

bug: Only last color definition in theme override is applied #3168

Closed
suburbanworrier opened this issue Aug 12, 2024 · 4 comments
Closed

bug: Only last color definition in theme override is applied #3168

suburbanworrier opened this issue Aug 12, 2024 · 4 comments

Comments

@suburbanworrier
Copy link

What version of daisyUI are you using?

v4.12.10

Which browsers are you seeing the problem on?

All browsers

Reproduction URL

https://play.tailwindcss.com/HPwAYbvcas?file=config

Describe your issue

Overriding one of the standard colors works fine by redefining the css var in tailwind.config.js

Overriding multiple colors introduces quirks with seemingly only the final var being honoured.

However in making the Tailwind Play file I noticed that it was possible to successfully override both the primary and secondary color but never all three of "primary", "secondary" and "accent".

I initially mocked this up in a Stackblitz at https://stackblitz.com/edit/daisyui-sveltekit-3ys4xm?file=tailwind.config.cjs where I've updated daisyUI to the latest version. Toggling the order of lines 17 & 18 in tailwind.config.cjs exposes the problem as I initially saw it.

Both of these showcase an issue I'm seeing in a larger SvelteKit project where I'm attempting to style button text color.

Copy link

Thank you @suburbanworrier for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

@suburbanworrier
Copy link
Author

More than happy to put some effort in to resolve this but honestly I'd need pointing in the right direction.

@saadeghi
Copy link
Owner

saadeghi commented Oct 24, 2024

In config, it must be accent-content because we process the built-in colors to generate the missing ones with a valid contrast.

light: {
  ...require('daisyui/src/theming/themes')['light'],
-  '--pc': '99% 0 0',
-  '--ac': '100% 0 0',
+  'primary-content': 'oklch(99% 0 0)',
+  'accent-content': 'oklch(100% 0 0)',
},

Docs: https://daisyui.com/docs/themes/#-5

I know it can be confusing where to use color name like --ac and where to use accent-content. It will be only CSS variable in daisyUI 5 to avoid confusion.

@suburbanworrier
Copy link
Author

Many thanks for providing the answer 🙇

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

No branches or pull requests

2 participants