tealdeer-rs/tealdeer

Ability to apply different colors for dark and light system theme

japanese-goblinn opened this issue · 5 comments

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

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

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

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

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

Yes, I think it will. Closing this one