change tailwind color based on api response
Using next 14, turbo, tailwind
I have an app that should change colors based on api response.
Can I somehow change the tailwind config primary color in the top of my next app in the head server component?
I think that it is possible in client component by adding style tag and adding new declaration of css variable, but i can’t do it in a server component
8 Replies
css variables
Im using css variables
im getting
document.documentElement.style.setProperty('--your-variable', '#YOURCOLOR');
document is only available in client components, or am i wrong?
yep
either ssr it or useEffect
why am i getting hydration error with this implementation
here [image]
but not here2 [image] so one layout.tsx deeper
Ok, i think the problem is that i put style not in a body or head tag