opencode: fix theme polarity for light base16 schemes#2192
Open
Programmerino wants to merge 1 commit intonix-community:masterfrom
Open
opencode: fix theme polarity for light base16 schemes#2192Programmerino wants to merge 1 commit intonix-community:masterfrom
Programmerino wants to merge 1 commit intonix-community:masterfrom
Conversation
OpenCode themes have separate "dark" and "light" color variants, used when the terminal reports dark or light mode respectively. The existing mapping always assigns base00 to the "dark" variant and base06 to "light". This is correct for dark-polarity base16 schemes (where base00 is a dark background), but inverted for light-polarity schemes (where base00 is a light background like #ffffff). The result is that light scheme users get dark colors when their terminal correctly reports light mode. Fix this by adding the polarity argument and swapping dark/light assignments when polarity is "light". No behavioral change for dark schemes. Also cleans up stray blank lines around syntaxKeyword and replaces verbose inline attrsets with a mkColor helper for readability.
0a00b63 to
78b45a7
Compare
trueNAHO
reviewed
Feb 8, 2026
Member
There was a problem hiding this comment.
The PR description must at least contain the mandatory checkbox from the PR template for us to potentially merge this code.
Also, CI is failing.
OpenCode themes have separate
darkandlightcolor variants, selected at runtime based on terminal background detection (OSC 11).
IIUC, if OpenCode follows the terminal polarity, why do we need to override the OpenCode polarity when the terminal should already respect this?
Could you provide screenshots for the {before,after} * {dark,light} matrix of this PR?
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.

Problem
OpenCode themes have separate
darkandlightcolor variants, selected at runtime based on terminal background detection (OSC 11). The existing mapping always assignsbase00to thedarkvariant andbase06tolight.For dark-polarity schemes (base00 = dark background), this is correct. For light-polarity schemes (e.g. base00 =
#ffffff), the assignments are inverted: when the terminal correctly reports light mode, OpenCode uses thelightvariant which contains the dark colors, and vice versa.The result is that light scheme users always see wrong colors regardless of terminal detection.
Fix
Add
polarityto the config function arguments and swapdark/lightassignments whenpolarity == "light". This follows the same pattern used by other modules (e.g.fnott,fuzzel,glance).A
mkColorhelper replaces the verbose inline attrsets, which also makes the module more readable and ~40% shorter.No behavioral change for dark-polarity schemes (the default code path is identical).