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

Implement per-block colour overrides #947

Merged
merged 1 commit into from
Nov 28, 2020
Merged

Conversation

ammgws
Copy link
Collaborator

@ammgws ammgws commented Nov 25, 2020

This will allow you to override colours on a per-block basis:
image

icons = "awesome5"

[[block]]
block = "uptime"
[block.color_overrides]
idle_fg = "#00ff00"
idle_bg = "#da11ff"

[[block]]
block = "time"
[block.color_overrides]
idle_fg = "#ff0000ff"
idle_bg = "#00aabbff"

[[block]]
block = "music"
[block.color_overrides]
info_fg = "#0000ff"
info_bg = "#aabbcc"

[[block]]
block = "time"
[block.color_overrides]
idle_fg = "#ff0000ff"
idle_bg = "#deadbeef"

The implementation may be a bit hacky but there doesn't seem to be a better way to achieve this, and I don't foresee the config changing regardless of the implementation in code (so any future rewrites should not break existing configs using block.color_overrides). I would rather have this feature out sooner than keeping users waiting (possibly forever) for a rewrite of the codebase.

It's possible some more work may be required so anyone willing to test this would be greatly appreciated!

@elliotf
Copy link

elliotf commented Nov 25, 2020

This works for me. My use case was to be able to quickly distinguish between the four clocks I have in different timezones:

[[block]]              
block = "time"         
interval = 60          
format = "%T%z"        
timezone = "UTC"       
#colour = "#AAFF88"    
[block.color_overrides]
idle_fg = "#aaffaa"    

# repeat with different colors for different timezones

@ammgws ammgws merged commit 42e5f09 into greshake:master Nov 28, 2020
@ammgws ammgws deleted the colours branch November 28, 2020 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Override colors per block
2 participants