terminal: Fix 8 bit colors - #54565
Merged
Merged
Conversation
Extract the contrast-skip predicate into is_app_chosen_exact_color and cover the 256-color palette boundary (15/16 and 231/232/255), true-color Spec, and theme-named variants so the chosen cutoff is locked in.
ConradIrwin
approved these changes
Apr 23, 2026
Member
|
Thanks! Willing to give this a go. |
ebaah46
pushed a commit
to ebaah46/zed
that referenced
this pull request
May 6, 2026
Right now the terminal rendering code applies a minimum contrast value (which is good, and for accessibility) to colors that appear, there was already an exemption from this for 24bit color specification, because the application explicitly asked for that color, so it should be rendered that color. My change changes that exemption to also include ansi colors 16-255, because these are also set explicitly, the normal, non-exempt case is now the default ansi colors, 0-15, these are set by the theme and are usually specified as just 'red' or 'green', hence the importance of the min contrast. Heres what the gradient ramp from the original issue looks like now: <img width="944" height="1123" alt="Screenshot 2026-04-22 at 6 45 43 PM" src="https://github.com/user-attachments/assets/918d62db-ed8e-475c-9ec1-c60187ad4b5e" /> This matches ghostty and VSCodium from the original issue. test prevents regressions but idk, maybe not nessecary. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes zed-industries#54396 Release Notes: - terminal: Improved 256 color ansi rendering
This was referenced May 13, 2026
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
Right now the terminal rendering code applies a minimum contrast value (which is good, and for accessibility) to colors that appear, there was already an exemption from this for 24bit color specification, because the application explicitly asked for that color, so it should be rendered that color. My change changes that exemption to also include ansi colors 16-255, because these are also set explicitly, the normal, non-exempt case is now the default ansi colors, 0-15, these are set by the theme and are usually specified as just 'red' or 'green', hence the importance of the min contrast. Heres what the gradient ramp from the original issue looks like now: <img width="944" height="1123" alt="Screenshot 2026-04-22 at 6 45 43 PM" src="https://github.com/user-attachments/assets/918d62db-ed8e-475c-9ec1-c60187ad4b5e" /> This matches ghostty and VSCodium from the original issue. test prevents regressions but idk, maybe not nessecary. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes zed-industries#54396 Release Notes: - terminal: Improved 256 color ansi rendering
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
Right now the terminal rendering code applies a minimum contrast value (which is good, and for accessibility) to colors that appear, there was already an exemption from this for 24bit color specification, because the application explicitly asked for that color, so it should be rendered that color. My change changes that exemption to also include ansi colors 16-255, because these are also set explicitly, the normal, non-exempt case is now the default ansi colors, 0-15, these are set by the theme and are usually specified as just 'red' or 'green', hence the importance of the min contrast. Heres what the gradient ramp from the original issue looks like now: <img width="944" height="1123" alt="Screenshot 2026-04-22 at 6 45 43 PM" src="https://github.com/user-attachments/assets/918d62db-ed8e-475c-9ec1-c60187ad4b5e" /> This matches ghostty and VSCodium from the original issue. test prevents regressions but idk, maybe not nessecary. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes zed-industries#54396 Release Notes: - terminal: Improved 256 color ansi rendering
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.
Right now the terminal rendering code applies a minimum contrast value (which is good, and for accessibility) to colors that appear, there was already an exemption from this for 24bit color specification, because the application explicitly asked for that color, so it should be rendered that color.
My change changes that exemption to also include ansi colors 16-255, because these are also set explicitly, the normal, non-exempt case is now the default ansi colors, 0-15, these are set by the theme and are usually specified as just 'red' or 'green', hence the importance of the min contrast.
Heres what the gradient ramp from the original issue looks like now:
This matches ghostty and VSCodium from the original issue.
test prevents regressions but idk, maybe not nessecary.
Self-Review Checklist:
Closes #54396
Release Notes: