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

Set background color via style.css #224

Open
scotabroad opened this issue Nov 14, 2022 · 5 comments
Open

Set background color via style.css #224

scotabroad opened this issue Nov 14, 2022 · 5 comments

Comments

@scotabroad
Copy link
Contributor

For both nwggrid and nwgbar, the background can be set using the -b option, with the opacity also be defined by -o. However, as both nwggrid and nwgbar have style.css files, it would make more sense to set this there and not via command line options.

@scotabroad
Copy link
Contributor Author

scotabroad commented Nov 20, 2022

nwgbar -b 000000 -o 0 or nwgbar -b 00000000 both make it possible so that the color of the background is provided by the .frame attribute below to nwgbar/style.css.

.frame {
  background: rgba (255, 255, 255, 0.5);
}

However, this does not seem like a good solution as it doesn't modify the window directly and requires making the window completely transparent. However, using any variation of the window or .background attributes do not affect the window/background color.

@Siborgium
Copy link
Collaborator

Siborgium commented Nov 25, 2022

Agreed. Honestly, specifying background color via arguments is kinda ugly, and we have to provide option to tweak it via CSS. I'll look into it, but no hard promises :)

@scotabroad
Copy link
Contributor Author

Thanks! I've also been trying to read up on how to do it. I've been looking into waybar how does it, as I've noticed it can take window#waybar{} to set the background color, though no equivalent CSS key currently exists for nwggrid or nwgbar that I could find. I'll keep you updated on anything else I find.

@Siborgium
Copy link
Collaborator

The following works

window > box {
    background-color: #abcdef
}

but it's not pretty at all.

window#waybar

This could be done by set_name("waybar") on the box.

@scotabroad
Copy link
Contributor Author

Yes, I have seen that in the Waybar code here: src/bar.cpp#L489 and have thought about adding something similar to nwggrid and nwgbar.

window > box {
    background-color: rgba(123, 23, 45, 0.5)
}

does work with nwggrid, and I have been able to do the same with nwgbar using

window > scrolled window {
   background-color: rgba(123, 23, 45, 0.5)
 }

However, both need to be launched with the -o 0 flag to get the opacity right, otherwise it overlays the color on top of the default one. Honestly, this is overall not too bad.

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