lsd-rs / lsd

The next gen ls command
Apache License 2.0
12.85k stars 420 forks source link

How to dynamically configure color scheme? #1009

Closed bartekpacia closed 4 months ago

bartekpacia commented 4 months ago

On my MacBook, I use light theme in my terminal during the day and dark theme during the night. By default, lsd looks great on black background, but on white it's barely legible:

Screenshot 2024-03-13 at 17 36 39

Similar problems arise in many CLI tools (e.g. micro editor), but I solved it like this:

if command -v micro >/dev/null 2>&1; then
    if [ "$(uname)" = Darwin ]; then
        # automatically set light/dark theme on macOS
        alias micro="micro -colorscheme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo monokai || echo bubblegum)"
    fi
fi

I'd like to do the same with lsd, but unfortunately it looks like it only accepts following values:

$ lsd --color <TAB COMPLETION>
always  auto    never

How can I dynamically select the theme like I showed in the first snippet above?

j-lakeman commented 4 months ago

See #208

zwpaper commented 4 months ago

hi the lsd theme can only be configured by configuration file or read from the theme file, please have a look at the configuration part in README

haohanyuzmx commented 1 month ago

i know it can config by color.yaml, but is it can use dynamic color