Misterio77 / nix-colors

Modules and schemes to make theming with Nix awesome.
GNU General Public License v3.0
465 stars 38 forks source link

reconciliating nix-colors with transparency? #41

Closed KiaraGrouwstra closed 8 months ago

KiaraGrouwstra commented 8 months ago

i tried using nix-colors to swap out the theme for e.g. rofi, then realized that otherwise i might use rgba to also set a transparency value. now, i'm not sure baking transparency into the color scheme (over application style) would make sense, as i suppose transparency isn't part of a color. but then, what might be a good way to go about setting transparency while using nix-colors?

Kyesarri commented 8 months ago

CSS: background-color: #${config.colorScheme.colors.base01}FF;

FF being the transparency

Bit of a hacky manual method but it works for my configuration.

KiaraGrouwstra commented 8 months ago

thanks! it looks like tinted-theming dealt with this by allowing to have the colors queried separately, but the workaround def seems nicer.

Misterio77 commented 3 months ago

Hey! Apologies for missing this issue.

If the #RRGGBBAA is not an option (or if you prefer decimal for whatever reason), you can use https://github.com/Misterio77/nix-colors/pull/18 's conversion functions.

nix-repl> nix-colors.lib.conversions.hexToRGB "000FFF"
[ 0 15 255 ]

For a CSS RGBA example:

.foo {
    background-color: rgba(${hexToRGBString "," config.colorscheme.palette.base00},0.75);
}