zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
20.67k stars 639 forks source link

Light/Dark theme option and mirroring system setting #3277

Open nazriel opened 5 months ago

nazriel commented 5 months ago

Hello,

I am using Light system theme during the day (since it "energizes" me more) and then dark system theme during the evening and night (since it saves my eyes and helps with winding down). OS automatically toggles between them depending on the time of the day.

Right now most of my apps follow this by default or with small help (like f-person/auto-dark-mode.nvim for nvim and little lua snippet for wezterm).

I was wondering if there is already working solution for this with Zellij? Either by default config (ie. akin to how Zed does it [1]), plugin oraz 3rd party solution?

[1]

"theme": {
  "mode": "light" | "dark" | "system",
  "dark": "One Dark",
  "light": "One Light"
},
mikaoelitiana commented 4 months ago

This is also a feature I am really looking forward to having

nazriel commented 4 months ago

From the likes and @mikaoelitiana comment I will assume that I am not blind and such functionality is not available yet. ~I will give it a try to implement it and share it here~

UPDATE: I won't be working on it since there is no interest for such functionality by maintainers (based on discord discussion).

If someone really wants to pull this of before dynamic config reload is ready or there is a support for transparency in colors palette feel free to checkout my branch on my fork. it works already once Appearence changes and you detach and reattach session. I've only tested it on macos though

cristiand391 commented 4 months ago

Config live-reloading isn't supported yet so there's no plugin that can do something like this today.

nazriel commented 4 months ago

I was thinking about something like that:

https://github.com/zellij-org/zellij/pull/3293

Idea was following:

  1. Introducing new config options: theme_dark, theme_light
  2. During client startup we detect current system theme and see if corresponding theme_dark/theme_light is set - if yes we create palette based on theme set in theme_dark/theme_light variable - if no we fallback to theme or use "default" if even theme is not set. (already works)
  3. In client we poll and check if system theme changed and if so we send message to server to resync client_attributes with new palette set (still WIP)
cristiand391 commented 4 months ago

IMO, config live-reload is enough to allow people script this in any OS/distribution.

I would rather prefer to setup mac/linux to run a script (when switching dark<->light mode) that updates the current theme in my config.kdl than have the zellij server to constantly poll for system theme changes.