Skip to content

Startup briefly paints a light colorscheme before the terminal’s dark background response #21605

Closed

Description

@jparise

Steps to reproduce

  1. Open a terminal (e.g. Ghostty) with a dark terminal background, without setting COLORFGBG.
  2. Use a minimal vimrc using a builtin colorscheme that supports both light and dark backgrounds:
set nocompatible
set termguicolors
colorscheme lunaperche

Do not explicitly set 'background'.

  1. Start vim and observe that Vim briefly displays the light variant before switching to the dark variant. vim -Nu /tmp/minimal.vim -i NONE -c 'redraw! | sleep 2' makes this very visible.

I originally encountered this with everforest. Vim correct detects the appropriate 'background', but the problem is the light-to-dark flash during startup.

Expected behaviour

The first paint should match the terminal's (dark) background, without the brief (light) flash.

The detection should work automatically for both light and dark background. Setting e.g. background=dark avoids the flash but prevents automatic adapting to light terminals.

Version of Vim

9.2.1200

Environment

OS: macOS 27.0.1, Apple Silicon (arm64)
Terminal: Ghostty 1.3.2-main+d2865b8f5
Shell: bash 5.3.20

TERM=xterm-ghostty
TERM_PROGRAM=ghostty
COLORFGBG unset

Logs and stack traces

No crash or logs. This is just a visual issue during startup.

Related

Activity

  1. mao-yining commented on Oct 20, 2026

    @mao-yining
    Contributor

    try set $COLORFGBG=15;0 in bashrc

  2. jparise commented on Oct 20, 2026

    @jparise
    ContributorAuthor

    3. try set $COLORFGBG=15;0 in bashrc

    I'm familiar with COLORFGBG. The issue is about vim's own background color detection at startup.

    Relying on COLORFGBG would mean moving the problem elsewhere (e.g. to the shell), which would need to update COLORFGBG whenever the terminal's colors changed.

  3. akasakariko commented on Oct 26, 2026

    @akasakariko
    Contributor

    I'd like to work on this

  4. dkearns commented on Oct 26, 2026

    @dkearns
    Contributor

    @akasakariko, thanks it's all yours.

  5. added 5 commits that reference this issue on Oct 26, 2026
    93cb573
    7277aaf
    1e18739
    7d40247
    61f336c
  6. added 2 commits that reference this issue on Nov 14, 2026
    3a39bd1
    48cf56f
  7. added a commit that references this issue on Nov 21, 2026
    d802230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions