opencode: fix theme polarity for light base16 schemes#2322
Conversation
trueNAHO
left a comment
There was a problem hiding this comment.
From #2192 , which seems stalled to me:
This PR seems to have taken the literal code from #2192 without crediting the original #2192 author in the commit.
This also means the
- I certify that I have the right to submit this contribution under the MIT license
statement is equally doubtful...
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 elaborate on this? Is there no more reliable solution than manually inverting dark and light values, otherwise what is their purpose?
| tui = { | ||
| theme = "stylix"; | ||
| in | ||
| { | ||
| tui = { inherit theme; }; | ||
| themes.${theme} = { | ||
| theme = { | ||
| accent = { | ||
| dark = colors.withHashtag.base0F; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| background = { | ||
| dark = colors.withHashtag.base00; | ||
| light = colors.withHashtag.base06; | ||
| }; | ||
| backgroundElement = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base04; | ||
| }; | ||
| backgroundPanel = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| border = { | ||
| dark = colors.withHashtag.base02; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| borderActive = { | ||
| dark = colors.withHashtag.base03; | ||
| light = colors.withHashtag.base02; | ||
| }; | ||
| borderSubtle = { | ||
| dark = colors.withHashtag.base02; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| diffAdded = { | ||
| dark = colors.withHashtag.base0B; | ||
| light = colors.withHashtag.base0B; | ||
| }; | ||
| diffAddedBg = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| diffAddedLineNumberBg = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| diffContext = { | ||
| dark = colors.withHashtag.base03; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| diffContextBg = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| diffHighlightAdded = { | ||
| dark = colors.withHashtag.base0B; | ||
| light = colors.withHashtag.base0B; | ||
| }; | ||
| diffHighlightRemoved = { | ||
| dark = colors.withHashtag.base08; | ||
| light = colors.withHashtag.base08; | ||
| }; | ||
| diffHunkHeader = { | ||
| dark = colors.withHashtag.base03; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| diffLineNumber = { | ||
| dark = colors.withHashtag.base03; | ||
| light = colors.withHashtag.base04; | ||
| }; | ||
| diffRemoved = { | ||
| dark = colors.withHashtag.base08; | ||
| light = colors.withHashtag.base08; | ||
| }; | ||
| diffRemovedBg = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| diffRemovedLineNumberBg = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base05; | ||
| }; | ||
| error = { | ||
| dark = colors.withHashtag.base08; | ||
| light = colors.withHashtag.base08; | ||
| }; | ||
| info = { | ||
| dark = colors.withHashtag.base0C; | ||
| light = colors.withHashtag.base0F; | ||
| }; | ||
| markdownBlockQuote = { | ||
| dark = colors.withHashtag.base03; | ||
| light = colors.withHashtag.base01; | ||
| }; | ||
| markdownCode = { | ||
| dark = colors.withHashtag.base0B; | ||
| light = colors.withHashtag.base0B; | ||
| }; | ||
| markdownCodeBlock = { | ||
| dark = colors.withHashtag.base01; | ||
| light = colors.withHashtag.base00; | ||
| }; | ||
| markdownEmph = { | ||
| dark = colors.withHashtag.base0A; | ||
| light = colors.withHashtag.base09; | ||
| }; | ||
| markdownHeading = { | ||
| dark = colors.withHashtag.base0E; | ||
| light = colors.withHashtag.base0F; | ||
| }; | ||
| markdownHorizontalRule = { | ||
| dark = colors.withHashtag.base04; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| markdownImage = { | ||
| dark = colors.withHashtag.base0D; | ||
| light = colors.withHashtag.base0D; | ||
| }; | ||
| markdownImageText = { | ||
| dark = colors.withHashtag.base0C; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| markdownLink = { | ||
| dark = colors.withHashtag.base0D; | ||
| light = colors.withHashtag.base0D; | ||
| }; | ||
| markdownLinkText = { | ||
| dark = colors.withHashtag.base0C; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| markdownListEnumeration = { | ||
| dark = colors.withHashtag.base0C; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| markdownListItem = { | ||
| dark = colors.withHashtag.base0D; | ||
| light = colors.withHashtag.base0F; | ||
| }; | ||
| markdownStrong = { | ||
| dark = colors.withHashtag.base09; | ||
| light = colors.withHashtag.base0A; | ||
| }; | ||
| markdownText = { | ||
| dark = colors.withHashtag.base05; | ||
| light = colors.withHashtag.base00; | ||
| }; | ||
| primary = { | ||
| dark = colors.withHashtag.base0D; | ||
| light = colors.withHashtag.base0F; | ||
| }; | ||
| secondary = { | ||
| dark = colors.withHashtag.base0E; | ||
| light = colors.withHashtag.base0D; | ||
| }; | ||
| success = { | ||
| dark = colors.withHashtag.base0B; | ||
| light = colors.withHashtag.base0B; | ||
| }; | ||
| syntaxComment = { | ||
| dark = colors.withHashtag.base04; | ||
| light = colors.withHashtag.base03; | ||
| }; | ||
| syntaxFunction = { | ||
| dark = colors.withHashtag.base0D; | ||
| light = colors.withHashtag.base0C; | ||
| }; | ||
| syntaxKeyword = { | ||
| dark = colors.withHashtag.base0E; | ||
|
|
||
| light = colors.withHashtag.base0D; | ||
|
|
||
| }; | ||
| syntaxNumber = { | ||
| dark = colors.withHashtag.base09; | ||
| light = colors.withHashtag.base0E; | ||
| }; | ||
| syntaxOperator = { | ||
| dark = colors.withHashtag.base0C; | ||
| light = colors.withHashtag.base0D; | ||
| }; | ||
| syntaxPunctuation = { | ||
| dark = colors.withHashtag.base05; | ||
| light = colors.withHashtag.base00; | ||
| }; | ||
| syntaxString = { | ||
| dark = colors.withHashtag.base0B; | ||
| light = colors.withHashtag.base0B; | ||
| }; | ||
| syntaxType = { | ||
| dark = colors.withHashtag.base0A; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| syntaxVariable = { | ||
| dark = colors.withHashtag.base07; | ||
| light = colors.withHashtag.base07; | ||
| }; | ||
| text = { | ||
| dark = colors.withHashtag.base05; | ||
| light = colors.withHashtag.base00; | ||
| }; | ||
| textMuted = { | ||
| dark = colors.withHashtag.base04; | ||
| light = colors.withHashtag.base01; | ||
| }; | ||
| warning = { | ||
| dark = colors.withHashtag.base0A; | ||
| light = colors.withHashtag.base0A; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| themes.stylix = { inherit theme; }; |
There was a problem hiding this comment.
Revert to the previous behavior of parametrizing on the "stylix" theme name.
| theme = | ||
| if polarity == "light" then | ||
| builtins.mapAttrs (_: v: { | ||
| dark = v.light; | ||
| light = v.dark; | ||
| }) themeValues | ||
| else | ||
| themeValues; |
Co-authored-by: Davis Davalos-DeLosh <davis.davalos.delosh@gmail.com>
23e324c to
c67c8d1
Compare
|
Thank you for the review 😎 . I added the author of #2192 as co-author, it is their work I just vibe coded on top. As for licensing, well it's now been llm-washed and this is "inspired work."
I don't have the slightest idea. Could be just broken on their end, I guess. Devin thinks that should've worked all along. I'll figure it out and get back to ya |
|
#2348 better fix, I think. |
From #2192 , which seems stalled to me:
before:
after:
Code logic for dark polarity is unchanged.