Skip to content

generate 256 palette#11043

Open
jake-stewart wants to merge 3 commits intoEugeny:masterfrom
jake-stewart:master
Open

generate 256 palette#11043
jake-stewart wants to merge 3 commits intoEugeny:masterfrom
jake-stewart:master

Conversation

@jake-stewart
Copy link
Copy Markdown

Hi Tabby team,

I believe that terminals should generate the extended 256-color palette based on the user's base16 theme.

The rationale and approach is written up here.

This PR introduces a new generate256ColorPalette config option, enabled by default, which generates the colors 16-255 via interpolating the users base16 theme. No colors explicitly defined by the user are replaced.

The settings page is updated to allow toggling this functionality.

@jake-stewart
Copy link
Copy Markdown
Author

Closes #11040

@jake-stewart
Copy link
Copy Markdown
Author

This PR is not ready:

There is active discussion at the Ghostty repo about approaching this slightly differently.

The idea is that light themes should not invert the palette so that ansi 16 remains black. This is with the intention of removing the breaking change of generating by default. Then, an opt-in option for "harmonious" colors which inverts the colors for light themes since there are advantages for doing so.

@jake-stewart
Copy link
Copy Markdown
Author

This PR is tested and ready.

It adds two configuration options that are both opt-in:

  • paletteGenerate Whether to generate the extended 256-color palette based on the user's base16 theme.
  • paletteHarmonious Whether to invert generated light themes for more semantic colors.

Both options have toggles in the color scheme settings tab. The harmonious toggle is only visible when palette generation is enabled.

The config and behaviour is consistent with other PRs/emulators.


The default 256-color palette interpolates from black to white. This means it works better for dark themes since the dark shades are closer to the background and light shades are closer to the foreground. For light themes, the opposite is true, and so a UI designed for dark themes using the default 256-color palette looks bad with light themes.

That is the purpose of the paletteHarmonious option: It inverts light themes so light/dark palettes are semantically equivalent. It makes shades interpolate from BG to FG instead of from black to white.

The paletteHarmonious is opt-in to be consistent with Ghostty. You could delete this option and only ever generate harmonious palettes. This would be fine since the palette generation is opt-in. However, you will be unable to make paletteGenerate default in the future without breaking changes.

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.

1 participant