feat(theme): custom themes can use calculated system colors#6321
Closed
nihil2501 wants to merge 16 commits intoanomalyco:devfrom
Closed
feat(theme): custom themes can use calculated system colors#6321nihil2501 wants to merge 16 commits intoanomalyco:devfrom
system colors#6321nihil2501 wants to merge 16 commits intoanomalyco:devfrom
Conversation
1 task
system colors
This reverts commit 91d5ce8.
Leaves proper resolution of "system" to `generateSystem` output until a later commit.
TODO: Fix type errors in `src/cli/cmd/tui/component/dialog-theme-list.tsx`.
6a49fef to
583c5ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GH Issue
This makes it possible for custom themes to configure specific theme colors to use the calculated
systemvalues, e.g.:{ "theme": { "accent": "system", "background": "#000000" } }Example
In this example, pop-dark.json, I have a custom theme which sets specific syntax colors, but falls back to
"system"for everything else. This "extreme" example shows syntax highlighting I took from Helix's "Pop Dark" theme, and everything else OpenCode is deriving given that Ghostty's theme is set to "HaX0R Blue".Description
OpenCode themes address UI concepts that don't necessarily exist in themes for other tools like Helix, e.g.:
backgroundElementbackgroundMenubackgroundPanelborderborderActiveborderSubtleIn my case, I wanted to make a custom theme that matches what I have in Helix. I also already have terminal ANSI colors that match my Helix theme. Rather than go through the manual work to choose colors for every slot OpenCode offers, this change lets you customize some colors, while falling back to the values of the calculated
systemtheme for the rest.Commits
This PR has a series of preliminary refactor and fix commits that set up the implementation of the feature. The preliminary refactor half of this change might be desirable to merge on its own terms, even if the feature request is rejected.
Preliminary fixes
Admittedly the two fixes are not directly about the feature, but maybe they're welcome to be brought in with the rest of the changes to this file:
fix(theme): system light & darksystemtheme now reacts toToggle appearancefix(theme): custom theme load error fallbackFeature implementation
The rest of the non-refactor commits implement the feature:
feat(theme): add "system" color value to theme schemafeat(theme): init considers system-like custom themesfeat(theme): resolveTheme resolves "system"