zellij-org / zellij

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

Light/Dark theme option and mirroring system setting #3277

Open nazriel opened 7 months ago

nazriel commented 7 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 6 months ago

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

nazriel commented 6 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 6 months ago

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

nazriel commented 6 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 6 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.

TheButlah commented 1 month ago

If its a helpful datapoint, I would prefer not to have multiple config files for zellij, with one per theme. Instead, I think having the concept of multiple themes defined in the config makes more sense. You can then in your config file designate one as the default dark mode theme, one as the default light mode theme, and then configure whether the light mode is dark, light, or automatic by default.

You can also have a command to control the mode, to enable people to script this. But I do think that automatic should be one of the options to use for modes, for those of us who just want a good all in one system without additional scripting.