Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration to specify separate light/dark mode theme #2735

Merged
merged 15 commits into from
Nov 20, 2024
Merged

Configuration to specify separate light/dark mode theme #2735

merged 15 commits into from
Nov 20, 2024

Conversation

mitchellh
Copy link
Contributor

@mitchellh mitchellh commented Nov 20, 2024

Fixes #2725

This introduces the following configuration style that will set the terminal theme depending on the current system theme. This works on both macOS and GTK builds.

theme = light:rose-pine-dawn,dark:rose-pine

This comes with some known limitations and bugs that are documented on theme. These can be fixed in the future, but they relate to specific configuration permutations and I don't think it's worth blocking this PR on it. I've mitigated some of the bugs by simply disabling some configurations when a light/dark mode theme is specified.

The core of this is implemented using the building blocks for a more generic conditional configuration system as discussed in the original discussion #2356. There is still some work to make this robust for any configuration value but a lot of complex groundwork has been laid...

Demo

CleanShot.2024-11-19.at.16.20.21.mp4

@@ -209,7 +209,7 @@ fn canTrackDiags(comptime T: type) bool {
/// This may result in allocations. The allocations can only be freed by freeing
/// all the memory associated with alloc. It is expected that alloc points to
/// an arena.
fn parseIntoField(
pub fn parseIntoField(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this needs to be public in the current revision.

@mitchellh
Copy link
Contributor Author

Bug in GTK:

image

@mitchellh mitchellh merged commit 53dba18 into main Nov 20, 2024
34 checks passed
@mitchellh mitchellh deleted the theme branch November 20, 2024 22:12
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.

Support separate light and dark theme to match system theme
2 participants