Skip to content

Support mode 2031 dark/light mode detection#14356

Merged
the-mikedavis merged 1 commit intomasterfrom
mode-2031
Sep 21, 2025
Merged

Support mode 2031 dark/light mode detection#14356
the-mikedavis merged 1 commit intomasterfrom
mode-2031

Conversation

@the-mikedavis
Copy link
Copy Markdown
Member

Fixes #13281.

For better compatibility in detection we can also look at querying OSC 11 for the terminal's background color and trying to detect its perceived lightness (also see #12238). That will take a bit more work to add OSC 11 to Termina and then to handle the response.

@the-mikedavis the-mikedavis added the A-theme Area: Theme and appearence related label Aug 31, 2025
@colemickens
Copy link
Copy Markdown

Tested! Works with ghostty!

Comment thread book/src/themes.md Outdated
dark = "catppuccin_frappe"
light = "catppuccin_latte"
# Optional. Defaults to the theme set for `dark` if not specified.
# no-preference = "catppuccin_frappe"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a NIT: the option no_preference, while it makes total sense in the code, may be confusing for the user (i.e. why would I set my theme to not have a preference?). What do you think of using something like default or fallback instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@cor cor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been running this for a week and it works flawlessly!

Very nice UX improvement

@the-mikedavis the-mikedavis merged commit 23a647a into master Sep 21, 2025
7 checks passed
@the-mikedavis the-mikedavis deleted the mode-2031 branch September 21, 2025 15:41
littleblack111 pushed a commit to littleblack111/helix that referenced this pull request Sep 29, 2025
@Nico-Mayer
Copy link
Copy Markdown

Hey, I tested this using a Helix build from source and Ghostty on macOS, but Helix seems to always default to the dark theme regardless of my system appearance settings.

Helix config (config.toml):

[theme]
dark = "catppuccin_frappe"
light = "catppuccin_latte"

Ghostty config:

theme = dark:Catppuccin Frappe, light:Catppuccin Latte

In Ghostty, the theme correctly switches when toggling the system appearance, but Helix always uses the dark theme regardless of the system setting.

@loralb
Copy link
Copy Markdown

loralb commented Oct 17, 2025

@Nico-Mayer look at #14534

alschena pushed a commit to alschena/helix that referenced this pull request Nov 13, 2025
kfatyuip pushed a commit to kfatyuip/helix that referenced this pull request Nov 21, 2025
tomgroenwoldt pushed a commit to tomgroenwoldt/helix that referenced this pull request Jan 15, 2026
Eucladia pushed a commit to Eucladia/helix that referenced this pull request Jan 20, 2026
braydnm pushed a commit to braydnm/helix that referenced this pull request Mar 23, 2026
Cherry-picked from 23a647a and adapted for the multi-client crossterm
architecture. Adds theme::Mode, theme::Config (with light/dark/fallback
deserialization), and get_theme_mode() to the Backend trait. The crossterm
backend returns None for now since it doesn't support mode 2031 detection.

Co-Authored-By: Michael Davis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-theme Area: Theme and appearence related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support mode 2031 dark/light mode detection

5 participants