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

Css Variables #159

Closed
weasnerb opened this issue Feb 2, 2019 · 9 comments
Closed

Css Variables #159

weasnerb opened this issue Feb 2, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@weasnerb
Copy link

weasnerb commented Feb 2, 2019

Is there any way that we can get support for Css Custom Properties (variables)?

I would love to import the generated css vars from pywal so that I can style waybar with the generated colors. It seems that the :root selector is not supported with whatever parsing system is being used in the project.

@Alexays Alexays added the enhancement New feature or request label Feb 2, 2019
@Alexays
Copy link
Owner

Alexays commented Feb 2, 2019

In GTK you can do something like this

@define-color custom rgb (181, 171, 156);

#clock {
	color: @custom
}

@weasnerb
Copy link
Author

weasnerb commented Feb 2, 2019

Awesome! Thanks to pywal allowing me to use custom user defined templates this works right out of the box. Thanks!

@weasnerb weasnerb closed this as completed Feb 2, 2019
@AymanLyesri
Copy link

Please can u explain how did u achieve it? or provide a code example, thanks :)

@weasnerb
Copy link
Author

weasnerb commented Nov 5, 2023

Please can u explain how did u achieve it? or provide a code example, thanks :)

I created a template file like this:
https://github.com/weasnerb/linux-dots/blob/main/src/.config/wal/templates/colors-custom-gtk3.css

And imported it into my waybar/style.css like this:
https://github.com/weasnerb/linux-dots/blob/main/src/.config/waybar/style.css

@helixoid
Copy link

How do you autoreload the waybar once you change the colorscheme?

@weasnerb
Copy link
Author

Honestly I just reload my entire window manager, which will restart waybar.
I rarely change my background so it not auto-reloading doesn't bother me.

@amitds1997
Copy link

amitds1997 commented Feb 24, 2024

How do you autoreload the waybar once you change the colorscheme?

Just set reload_style_on_change to true in your waybar configuration. (Wiki Link)

If you have waybar >= v0.9.5 (FAQ), then run killall -SIGUSR2 waybar else create a script like so:

#!/usr/bin/env bash

pkill waybar
waybar &

and call it in your colorscheme updating logic.

For example, I change my wallpaper using swww and pywal then it could be something like this:

swww img "<img>" --transition-fps 30 --transition-type center --transition-duration 1
wal -i "<img>" -n -q

# Reload waybar
"<script-or-command>"

Another way is to follow what is mentioned in this comment: #961 (comment) and add your colorscheme file as one of the "notifywait" files.

@rickalex21
Copy link

The down side to using GTK variables is it will throw warnings in neovim with css lsp and
there's no way to disable them. Any other suggestions?

I don't understand why css variables not allowed.

@solitudealma
Copy link

The down side to using GTK variables is it will throw warnings in neovim with css lsp and使用 GTK 变量的缺点是它会在 neovim 中使用 css lsp 和 there's no way to disable them. Any other suggestions?没有办法禁用它们。还有其他建议吗?

I don't understand why css variables not allowed.我不明白为什么不允许使用 css 变量。

define use less not css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants