Skip to content

Use GUI hex colors in themes for true color support - #243

Merged
shugo merged 2 commits into
mainfrom
use-gui-hex-colors-in-themes
Apr 3, 2026
Merged

Use GUI hex colors in themes for true color support#243
shugo merged 2 commits into
mainfrom
use-gui-hex-colors-in-themes

Conversation

@shugo

@shugo shugo commented Apr 3, 2026

Copy link
Copy Markdown
Owner

Update all theme palettes to use the original Vim/Neovim GUI hex values (guifg/guibg) instead of 256-color approximations. This gives accurate colors on direct color terminals (TERM=xterm-direct) while the Color module still finds the closest 256-color match on other terminals.

Update all theme palettes to use the original Vim/Neovim GUI hex values
(guifg/guibg) instead of 256-color approximations. This gives accurate
colors on direct color terminals (TERM=xterm-direct) while the Color
module still finds the closest 256-color match on other terminals.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates bundled Textbringer themes to use upstream GUI hex palette values (guifg/guibg) so colors render accurately on true-color terminals while still mapping to nearest 256-color values when needed.

Changes:

  • Replaced 256-color-derived hex approximations with upstream GUI hex palette values across multiple themes.
  • Tweaked a few face definitions to better match upstream styling (e.g., bold function names, updated popup selection colors).
  • Updated the theme-porting skill doc to standardize on GUI hex as the source of truth.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/textbringer/themes/tokyonight.rb Adjusts palette commentary and updates one derived GUI hex value.
lib/textbringer/themes/sonokai.rb Replaces palette colors with upstream GUI hex and adjusts isearch/popup selection styling.
lib/textbringer/themes/molokai.rb Switches from cterm-derived colors to GUI hex values and refines punctuation coloring.
lib/textbringer/themes/gruvbox.rb Updates dark/light palettes to GUI hex and makes function names bold.
lib/textbringer/themes/github.rb Updates light palette GUI hex values and clarifies type color note.
lib/textbringer/themes/catppuccin.rb Updates both Mocha/Latte palettes to official GUI hex definitions.
.claude/skills/port-theme/SKILL.md Updates guidance to always use GUI hex values and revises the recommended theme template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/textbringer/themes/sonokai.rb Outdated
t.face :control
t.face :region, background: :bg4
t.face :isearch, foreground: :bg0, background: :green
t.face :isearch, foreground: :bg0, background: :green, reverse: true

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

reverse: true inverts the color pair (via Curses::A_REVERSE), so with foreground: :bg0, background: :green this will render as green text on bg0 rather than bg0 text on a green highlight. Either drop reverse: true here, or swap the foreground/background values (as done in gruvbox.rb) to keep the intended highlight colors when reversed.

Suggested change
t.face :isearch, foreground: :bg0, background: :green, reverse: true
t.face :isearch, foreground: :green, background: :bg0, reverse: true

Copilot uses AI. Check for mistakes.
Comment thread .claude/skills/port-theme/SKILL.md Outdated

Convert xterm-256 color numbers to hex:
**Vim themes:**
Use the `guifg`/`guibg` hex values (e.g. `#F92672`), NOT `ctermfg`/`ctermbg` numbers. If a Vim theme only provides cterm values without GUI values, convert them to hex using the xterm-256 color table:

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

This section uses an uppercase hex example (#F92672) but later the guide states that hex values must be lowercase. Consider changing the example to lowercase to match the documented convention and avoid confusion.

Suggested change
Use the `guifg`/`guibg` hex values (e.g. `#F92672`), NOT `ctermfg`/`ctermbg` numbers. If a Vim theme only provides cterm values without GUI values, convert them to hex using the xterm-256 color table:
Use the `guifg`/`guibg` hex values (e.g. `#f92672`), NOT `ctermfg`/`ctermbg` numbers. If a Vim theme only provides cterm values without GUI values, convert them to hex using the xterm-256 color table:

Copilot uses AI. Check for mistakes.
- Swap foreground/background in sonokai isearch so reverse renders correctly
- Use lowercase hex in port-theme skill example to match documented convention

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@shugo
shugo merged commit 78cb0aa into main Apr 3, 2026
7 checks passed
@shugo
shugo deleted the use-gui-hex-colors-in-themes branch April 3, 2026 06:05
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.

2 participants