Comments (8)
Yeah, sorry. Since the support of transparency requires this: rgba(var(--color-variable), var(--opacity-variable))
, for consistency, non-transparent color use the RGB format, which allows for more flexibility.
If this is a concern, there is a possibility to PR a change that adds a setting to the ThemeBuilder
to output non-transparent colors as hexadecimal values instead.
from tailwindcss-theming.
Hey @sijad, can you test tailwindcss-theming@hex
and use the hexadecimal()
method on your ThemeBuilder
?
It should do exactly what you want :)
https://github.com/hawezo/tailwindcss-theming/releases/tag/v2.4.0
from tailwindcss-theming.
Hi, what do you mean? You can pass any valid color if that's what you mean.
https://github.com/hawezo/tailwindcss-theming/blob/master/docs/configuration.md#colors
from tailwindcss-theming.
sorry for not explaining my use case.
I wanted to pass custom values by wrapping my elements inside a div
and pass customized variables.
for example:
<div style="--color-brand: #ff00ff">...
but it's not possible to do it without converting color to RGB.
from tailwindcss-theming.
I think this is not the right package for me, I'm going to pass variables to tailwind as directly:
module.exports = {
theme: {
colors: {
primary: 'var(--color-primary)',
background: 'var(--color-background)',
heading: 'var(--color-heading)',
text: 'var(--color-text)',
},
},
};
thanks for your great package
from tailwindcss-theming.
Thanks!
wouldn't it more clear to always pass color directly instead of in-lining rgb(a)
why not passing color to root as is (rgba
in case of alpha, hex
otherwise)?
if this is necessary, IMO naming it hexadecimal
is not proper, because it's also possible pass values in rgb(a) too, <div style="--color-brand: rgba(255,0,255,200)">
from tailwindcss-theming.
wouldn't it more clear to always pass color directly instead of in-lining rgb(a)
I'm not sure what you mean? Abandoning the RGB/RGBA way of working. This is not possible because of the reason below.
why not passing color to root as is (rgba in case of alpha, hex otherwise)?
This is necessary to be able to work with opacity. This plugin leverages the annoying work so the user only has to specify the wanted color.
I think the hexadecimal
name is appropriate though, because it does what its name says: it outputs the variables as hexadecimal instead of RGB/RGBA. For instance, if you set the color white
in your theme, it will output --color-name: #FFFFFF
instead of --color-name: 255,255,255
previsouly, and the utilities will be color: var(--color-name)
instead of color: rgb(var(--color-name))
.
Although this allows you to define the colors in whatever format you want by inlining them (style="--color-name: #fff"
), the plugin itself outputs them in hexadecimal and just that. The difference is that it won't use the rgb
and rgba
functions anymore.
Anyway, regardless of how the internals work, can you tell me if it works as you'd want? Remember to call the hexadecimal
method on your ThemeBuilder
. You can still enter the color in whatever format you want in your themes, they will be converted.
from tailwindcss-theming.
I'm closing this issue. Feel free to reopen or create a new one about this topic if needed.
from tailwindcss-theming.
Related Issues (20)
- When I required theme.config.js IN tailwind.config.js, then failed to compile. HOT 5
- Fix strategy precedence when applied to `html` HOT 6
- Add custom variants HOT 1
- Object-based variant configuration HOT 1
- Add `useTheme` composable function HOT 1
- Add `dark` and `light` variants HOT 1
- Need a video how to use this :c HOT 3
- how can I avoid having all the default colours replaced? HOT 2
- how to use with custom utilities? such as for gradients HOT 1
- [Feature request] Tailwind 1.4.0 support - new color opacity utilities HOT 8
- Automatically define a variable's prefix
- Multi-word, kebab-cased font variables get camel-cased HOT 2
- Theme-based Tailwind variants HOT 10
- Create a theme at runtime HOT 6
- Allow to add object as variant HOT 1
- theme.config.js file not found HOT 5
- Compatibility with TailwindUI? HOT 2
- There is no license file that includes the copyright and permission notice HOT 2
- Tailwind 2 compatibility? HOT 6
- Variables created but classes not generated when using Astro. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss-theming.