Skip to content

--theme auto results in the fallback to the default theme #3641

Open

Description

@savchenko

What steps will reproduce the bug?

  1. Configure the environment as following:

    BAT_PAGER=less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse
    BAT_STYLE=plain,changes
    BAT_THEME=auto
    BAT_THEME_DARK=neovim-dark
    BAT_THEME_LIGHT=neovim-light
    
  2. Launch a dark terminal. I am using foot version 1.26.1 with $TERM set to foot-direct. Here are the colours:

    Image

  3. Create a tiny foo.py to test the highlighting:

    def foo(bar: list[int]) -> str:
        baz, *blah = bar
        return f"{baz}-{blah}"
    
    print(foo([1, 2, 3, 4]))

What happens?

  1. bat foo.py falls back to the default theme:

    Image

What did you expect to happen instead?

When terminal is dark (also, org.gnome.desktop.interface color-scheme is prefer-dark), I would expect bat to respect the BAT_THEME=auto as per manual. So when the terminal is dark it should be:

Image

And when the terminal is light:

Image

How did you install bat?

GitHub release.


bat version and environment

bat 0.25.0

bat has been built without the 'bugreport' feature. The '--diagnostic' option is not available.

Activity

  1. keith-hall commented on Mar 22, 2026

    @keith-hall
    Collaborator

    The release notes for bat v0.26 mention that this bug was fixed in that version - probably you just need to upgrade 🙂

  2. hdp commented on Mar 31, 2026

    @hdp

    I'm having exactly this problem with bat 0.26.1 installed via homebrew

    BAT_CACHE_PATH=<not set>
    BAT_CONFIG_PATH=<not set>
    BAT_OPTS=<not set>
    BAT_PAGER=<not set>
    BAT_PAGING=<not set>
    BAT_STYLE=changes,grid,header-filename,snip
    BAT_TABS=<not set>
    BAT_THEME=<not set>
    COLORTERM=<not set>
    LANG=en_US.UTF-8
    LC_ALL=<not set>
    LESS=-R
    MANPAGER=<not set>
    NO_COLOR=<not set>
    PAGER=bat
    SHELL=/bin/zsh
    TERM=tmux-256color
    XDG_CACHE_HOME=<not set>
    XDG_CONFIG_HOME=<not set>

    Note these don't show up in bat --diagnostic despite being in my environment. (Putting --theme-dark=... etc. in my config file doesn't change the behavior shown below.)

    BAT_THEME_LIGHT=Kanagawa Lotus
    BAT_THEME_DARK=Kanagawa Wave
    

    Running cat foo.py:

    Got:
    Image

    Expected:
    Image

    (I have to run cat --theme 'Kanagawa Wave' foo.py to get this result)

  3. keith-hall commented on Apr 3, 2026

    @keith-hall
    Collaborator

    I'm having exactly this problem with bat 0.26.1 installed via homebrew

    Note these don't show up in bat --diagnostic despite being in my environment.

    @hdp I have merged #3661 which should fix the bat --diagnostic issue, and also adds some terminal color scheme debug info, so if you would be willing to build/install from source, it may give us some clues as to what is going wrong.

    TERM=tmux-256color

    Most likely your issue is due to running under tmux.
    #3207 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions