ANSI 24-bit RGB foreground color codes don't display correctly when close to the background color #21549

Closed
opened 2026-01-31 07:47:53 +00:00 by claunia · 4 comments
Owner

Originally created by @nora2605 on GitHub (Apr 18, 2024).

Windows Terminal version

1.19.10821.0

Windows build number

10.0.26100.1

Other Software

No response

Steps to reproduce

  1. echo an ANSI escape sequence like \u{001b}[38;2;255;255;255m (rgb: 255, 255, 255) for the foreground color and \u{001b}[48;2;0;255;0m (rgb: 0, 255, 0) for the background color (can be put together into one sequence) and some text to go after it
  2. for some specific color values close enough to each other in brightness (?), setting both foreground and background changes the colors. This does not happen when the fore-/background color sequences are alone; but it does happen if there is text between them.
    grafik

Expected Behavior

The colors should be shown accurately when specified like this.
The conhost.exe does this correctly.
grafik

Actual Behavior

The foreground color will be way darker or way brighter than expected depending if the background has reached a calculated brightness threshold.

Originally created by @nora2605 on GitHub (Apr 18, 2024). ### Windows Terminal version 1.19.10821.0 ### Windows build number 10.0.26100.1 ### Other Software _No response_ ### Steps to reproduce 1. echo an ANSI escape sequence like `\u{001b}[38;2;255;255;255m` (rgb: 255, 255, 255) for the foreground color and `\u{001b}[48;2;0;255;0m` (rgb: 0, 255, 0) for the background color (can be put together into one sequence) and some text to go after it 2. for some specific color values close enough to each other in brightness (?), setting both foreground and background changes the colors. This does not happen when the fore-/background color sequences are alone; but it does happen if there is text between them. ![grafik](https://github.com/microsoft/terminal/assets/51268331/f5a15372-d19c-42c2-8283-19f83670c519) ### Expected Behavior The colors should be shown accurately when specified like this. The conhost.exe does this correctly. ![grafik](https://github.com/microsoft/terminal/assets/51268331/c244f7eb-02f1-4249-8236-0eb36caba609) ### Actual Behavior The foreground color will be way darker or way brighter than expected depending if the background has reached a calculated brightness threshold.
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 07:47:53 +00:00
Author
Owner

@github-actions[bot] commented on GitHub (Apr 18, 2024):

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@github-actions[bot] commented on GitHub (Apr 18, 2024): Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! ### Closed similar issues: - [Unexpected behavior of ANSI 256 colors 0-7 and SGR 1? (#16768)](https://github.com/microsoft/terminal/issues/16768), similarity score: 0.77 - [Color Display Problems (#6473)](https://github.com/microsoft/terminal/issues/6473), similarity score: 0.77 - [Unexpected behaviour when bold and reverse ANSI attributes are combined (#128)](https://github.com/microsoft/terminal/issues/128), similarity score: 0.76 - [Background color not set when paging through a document with ANSI escape sequences (#5565)](https://github.com/microsoft/terminal/issues/5565), similarity score: 0.76 - [Background colour sometimes ignored in Windows Terminal (#8823)](https://github.com/microsoft/terminal/issues/8823), similarity score: 0.76 > Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Author
Owner

@DHowett commented on GitHub (Apr 18, 2024):

Thanks for filing! Are you using the “adjust the lightness of indistinguishable colors” setting? It’s on the profile appearance page.

@DHowett commented on GitHub (Apr 18, 2024): Thanks for filing! Are you using the “adjust the lightness of indistinguishable colors” setting? It’s on the profile appearance page.
Author
Owner

@nora2605 commented on GitHub (Apr 18, 2024):

I can't believe I didn't see that option the first time.
Thank you!

@nora2605 commented on GitHub (Apr 18, 2024): I can't believe I didn't see that option the first time. Thank you!
Author
Owner

@DHowett commented on GitHub (Apr 18, 2024):

Sure thing! Thanks for following up :)

@DHowett commented on GitHub (Apr 18, 2024): Sure thing! Thanks for following up :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21549