dnkl/foot
41
2.0k
Fork
You've already forked foot
243

generate 256-color palette #2283

Open
jake-stewart wants to merge 4 commits from jake-stewart/foot:master into master
pull from: jake-stewart/foot:master
merge into: dnkl:master
dnkl:master
dnkl:osc-5522
dnkl:sixel-heap-buffer-overflow
dnkl:releases/1.27
dnkl:releases/1.26
dnkl:releases/1.25
dnkl:releases/1.24
dnkl:multi-cursor
dnkl:releases/1.23
dnkl:pixman-16f-2
dnkl:releases/1.22
dnkl:releases/1.21
dnkl:releases/1.20
dnkl:releases/1.19
dnkl:releases/1.18
dnkl:releases/1.17
dnkl:releases/1.16
dnkl:releases/1.15
dnkl:releases/1.14
dnkl:releases/1.13
dnkl:releases/1.12
dnkl:releases/1.11
dnkl:releases/1.10
dnkl:releases/1.9
dnkl:releases/1.8
dnkl:releases/1.7
dnkl:releases/1.6
dnkl:releases/1.5
dnkl:releases/1.4
dnkl:releases/1.3
dnkl:releases/1.2
dnkl:releases/1.1
dnkl:releases/1.0
First-time contributor
Copy link

Hi Foot 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 generate-256-palette config option, (削除) enabled by default (削除ここまで) opt-in, which generates colors 16-255 by interpolating the user's base16 theme in CIELAB color space. No colors explicitly defined by the user are replaced.

I have introduced this to a few terminals already and plan to offer it to more soon.

Hi Foot 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](https://gist.github.com/jake-stewart/0a8ea46159a7da2c808e5be2177e1783). This PR introduces a new generate-256-palette config option, ~~enabled by default~~ opt-in, which generates colors 16-255 by interpolating the user's base16 theme in CIELAB color space. No colors explicitly defined by the user are replaced. I have introduced this to a few terminals already and plan to offer it to more soon.
fix build
All checks were successful
builds.sr.ht/freebsd-x64 Job completed
b80789c49a
Author
First-time contributor
Copy link

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.

This PR is not ready: There is active [discussion](https://github.com/ghostty-org/ghostty/discussions/10852) 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.
First-time contributor
Copy link

From the rationale doc:

The drawback is that 16 colors is limiting. Complex and color-heavy programs struggle with such a small palette.

Do you have evidence that this is really a problem? I can't say I have run into this myself.

From the rationale doc: > The drawback is that 16 colors is limiting. Complex and color-heavy programs struggle with such a small palette. Do you have evidence that this is really a problem? I can't say I have run into this myself.
dnkl changed title from (削除) Generate 256-color palette (削除ここまで) to WIP: generate 256-color palette 2026年03月02日 08:54:09 +01:00
make opt-in and add harmonious
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
44ac851237
Author
First-time contributor
Copy link

Do you have evidence that this is really a problem? I can't say I have run into this myself.

I find subtle background colors lacking for layered diffs. Grey shades missing for different levels of UI (status lines, visual mode, popups).

> Do you have evidence that this is really a problem? I can't say I have run into this myself. I find subtle background colors lacking for layered diffs. Grey shades missing for different levels of UI (status lines, visual mode, popups).
Merge branch 'master' into master
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
ci/woodpecker/pull_request_metadata/woodpecker Pipeline is pending approval
5b0b1a2e64
Author
First-time contributor
Copy link

This PR is tested and ready.

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

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

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 palette-harmonious 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 palette-harmonious 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 palette-generate default in the future without breaking changes.

This PR is tested and ready. It adds two configuration options that are **both opt-in**: - `palette-generate` Whether to generate the extended 256-color palette based on the user's base16 theme. - `palette-harmonious` Whether to invert generated light themes for more semantic colors. 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 `palette-harmonious` 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 `palette-harmonious` 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 `palette-generate` default in the future without breaking changes.
jake-stewart changed title from (削除) WIP: generate 256-color palette (削除ここまで) to generate 256-color palette 2026年03月16日 12:21:14 +01:00
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
ci/woodpecker/pull_request_metadata/woodpecker Pipeline is pending approval
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u master:jake-stewart-master
git switch jake-stewart-master

Merge

Merge the changes and update on Forgejo.
git switch master
git merge --no-ff jake-stewart-master
git switch jake-stewart-master
git rebase master
git switch master
git merge --ff-only jake-stewart-master
git switch jake-stewart-master
git rebase master
git switch master
git merge --no-ff jake-stewart-master
git switch master
git merge --squash jake-stewart-master
git switch master
git merge --ff-only jake-stewart-master
git switch master
git merge jake-stewart-master
git push origin master
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot!2283
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "jake-stewart/foot:master"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?