tealdeer-rs / tealdeer

A very fast implementation of tldr in Rust.
https://tealdeer-rs.github.io/tealdeer/
Apache License 2.0
4.17k stars 123 forks source link

Ability to apply different colors for dark and light system theme #281

Closed japanese-goblinn closed 2 years ago

japanese-goblinn commented 2 years ago

This is more macOS/Windows specific request because i don't really know is there a common API for this on linux but it'll be a nice to have ability to apply different color depending on current theme or even better - a different configs

japanese-goblinn commented 2 years ago

Also I'm learing Rust now and really like the idea to implement this myself and create PR if you don't mind c:

dbrgn commented 2 years ago

Is there an API to determine the current terminal theme on macOS and Windows?

japanese-goblinn commented 2 years ago

I was talking about system theme not a terminal theme. I think I came with even better idea than implementing interactions with vague API's. You just need to implement ability to pass a path to config directly to tldr so it'll betldr --config-path="$HOME/config.toml" and with a little wrapper around users can implement this on their platforms. For example in macOS it'll be something like this:

export TLDR_DARK_CONFIG="$HOME/dark_config.toml"
export TLDR_LIGHT_CONFIG="$HOME/light_config.toml"
alias tldr="tldr --config-path="$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo $TLDR_DARK_CONFIG || echo $TLDR_LIGHT_CONFIG)"
dbrgn commented 2 years ago

@japanese-goblinn yes, that looks like a good idea. Configurable config is being developed here: #141 Would that solve your issue?

japanese-goblinn commented 2 years ago

Yes, I think it will. Closing this one