sharkdp / vivid

A themeable LS_COLORS generator with a rich filetype datebase
Apache License 2.0
1.72k stars 86 forks source link

export VIVID_THEME as a envvar so that printenv will show active theme #140

Open dewcansam opened 1 month ago

dewcansam commented 1 month ago

main.rs ln 87 states that it is setting env var VIVID_THEME . I don't see it when using printenv. Is this being exported ? Or would it be possible to export it so that the active theme is displayed, when using printenv ? This would be a big help.

sharkdp commented 1 month ago

main.rs ln 87 states that it is setting env var VIVID_THEME

No. That is reading VIVID_THEME.

I don't see it when using printenv. Is this being exported ?

Even if we would set it, you can not export an environment variable from a process to the outer shell. That is not possible.

VIVID_THEME is a way for users to set the active theme. For example, I have this in my shells RC file:

if command -v vivid &> /dev/null; then
    export VIVID_THEME="molokai"
    export LS_COLORS="$(vivid generate)"
fi
dewcansam commented 1 month ago

OK I got ya. I have it set in my rc but I still have not figured out which theme I like so I have a tendency to set it on the term, then later forget which one I set. Got to thinking well I should be able to set it myself if I need. So this is what I do now. export vivid_theme=dracula; export LS_COLORS="$(vivid generate $vivid_theme)";

edit: I was reading my response and I don't think that I was being clear enough and I have expanded the way I change the vivid theme. If you want to 'test drive' a theme for a while. Then you need to set it on the command line and be able to track which theme you set. So set it via this method for temporary use, then when you have settled one which one you like follow sharkdp code for adding to the RC.

$ theme=snazzy; export VIVID_THEME=$theme; export LS_COLORS="$(vivid generate $theme)"

Remember this is for setting via the command line for temp usage.