Skip to content

feat: Mode based theming#15214

Open
patchunwrap wants to merge 2 commits intohelix-editor:masterfrom
patchunwrap:mode-based-themes
Open

feat: Mode based theming#15214
patchunwrap wants to merge 2 commits intohelix-editor:masterfrom
patchunwrap:mode-based-themes

Conversation

@patchunwrap
Copy link

@patchunwrap patchunwrap commented Jan 30, 2026

mode-based-themes

This commit adds a generic way of changing the color based on mode from the theme struct. This saves us from having to implement a match statement under every render function and makes the code rather readable whilst adding a lot more customisation to the user.

All theme options now support adding ".insert", ".select" and ".normal" to the key, and will apply those color/style choices directly. Specifying the theme key without those suffixes will be used as a fallback. So current themes should still work as expected.

@patchunwrap patchunwrap marked this pull request as draft January 30, 2026 21:39
@patchunwrap
Copy link
Author

I'm pushing this up now to mostly get feedback. This approach works and you can test it yourself with the following theme file (github won't let me upload.toml files):
switcher.toml.txt

The following need to be discussed/resolved before merging:

  • I need to add the same functionality to highlights.
  • What should I/we do with color-modes. Currently my patch ignores that option and I think that's the right decision. I think it's a confusing experience as a user to add .insert to my theme and then have to google the color-modes option when it doesn't work. Additionally it means we would have to specify 3 fields to the theme.get() function, which I'm not keen on?

I'm a new face so I'm happy to bend to the will of whoever maintains/owns this project and I'm also happy to change the approach if needed.

@patchunwrap patchunwrap changed the title Add support for changing every ui elements color based on mode feat: Add support for changing every ui elements color based on mode Jan 31, 2026
@patchunwrap patchunwrap marked this pull request as ready for review January 31, 2026 21:24
@patchunwrap
Copy link
Author

I decided to add a commit that fixes the color-modes functionality and also decided not to try fixing syntax highlighting. Even though syntax highlighting isn't possible I think this is more than enough customization for most people.

@patchunwrap patchunwrap changed the title feat: Add support for changing every ui elements color based on mode feat: Mode based theming Jan 31, 2026
This commit adds a generic way of changing the color based on mode
from the theme struct. This saves us from having to implement
a match statement under every render function and makes the code
rather readable whilst adding a lot more customisation to the user.

All theme options now support adding ".insert", ".select" and
".normal" to the key, and will apply those color/style choices
directly. Specifying the theme key without those suffixes
will be used as a fallback. So current themes should still work
as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant