Implement Delta E 2000 to correct color perception #3713

Closed
opened 2026-01-30 23:28:10 +00:00 by claunia · 14 comments
Owner

Originally created by @kojoru on GitHub (Sep 2, 2019).

Environment

Windows build number:  10.0.18362.0
Windows Terminal version : 0.4.2382.0
ConEmu version: 180626 

Steps to reproduce

  1. Copy the color palette for "<Solarized (John Doe)>" from ConEmu to terminal. Here's the relevant JSON:
        {   
            "white" : "#fdf6e3",
            "blue" : "#073642",
            "green" : "#586e75",
            "cyan" : "#657b83",
            "red" : "#dc322f",
            "purple" : "#6c71c4",
            "yellow" : "#cb4b16",
            "brightWhite" : "#eee8d5",
            "brightBlack" : "#93a1a1",
            "brightBlue" : "#268bd2",
            "brightGreen" : "#859900",
            "brightCyan" : "#2aa198",
            "brightRed" : "#839496",
            "brightPurple" : "#d33682",
            "brightYellow" : "#b58900",
            "black" : "#002B36",
            "background" : "#002B36",
            "foreground" : "#fdf6e3",
            "name" : "Solarized (John Doe)"
        }
  1. Set powershell's color scheme to "Solarized (John Doe)"
  2. Run [enum]::GetValues([System.ConsoleColor]) | Foreach-Object {Write-Host $_ -ForegroundColor $_} to admire the colors

Expected behavior

Colors look as nice as ConEmu's

Actual behavior

Most colors look nice and similar but "DarkBlue" looks completely different and way worse. See screenshot.
image

To get a somewhat similar color you need to set blue (DarkBlue) to something like "blue" : "#0B5669"
image

Originally created by @kojoru on GitHub (Sep 2, 2019). # Environment ```none Windows build number: 10.0.18362.0 Windows Terminal version : 0.4.2382.0 ConEmu version: 180626 ``` # Steps to reproduce 1. Copy the color palette for "<Solarized (John Doe)>" from ConEmu to terminal. Here's the relevant JSON: ```json { "white" : "#fdf6e3", "blue" : "#073642", "green" : "#586e75", "cyan" : "#657b83", "red" : "#dc322f", "purple" : "#6c71c4", "yellow" : "#cb4b16", "brightWhite" : "#eee8d5", "brightBlack" : "#93a1a1", "brightBlue" : "#268bd2", "brightGreen" : "#859900", "brightCyan" : "#2aa198", "brightRed" : "#839496", "brightPurple" : "#d33682", "brightYellow" : "#b58900", "black" : "#002B36", "background" : "#002B36", "foreground" : "#fdf6e3", "name" : "Solarized (John Doe)" } ``` 2. Set powershell's color scheme to "Solarized (John Doe)" 3. Run ` [enum]::GetValues([System.ConsoleColor]) | Foreach-Object {Write-Host $_ -ForegroundColor $_} ` to admire the colors # Expected behavior Colors look as nice as ConEmu's # Actual behavior Most colors look nice and similar but "DarkBlue" looks completely different and way worse. See screenshot. ![image](https://user-images.githubusercontent.com/1836172/64105642-e860be00-cd76-11e9-8ed3-c79598061e66.png) To get a somewhat similar color you need to set blue (DarkBlue) to something like `"blue" : "#0B5669"` ![image](https://user-images.githubusercontent.com/1836172/64105711-09c1aa00-cd77-11e9-8b39-1b5525650f92.png)
Author
Owner

@j4james commented on GitHub (Sep 2, 2019):

It looks to me like it's cmder that might be getting the color wrong. I suggest you try out those color values in an HTML document with a little test like this:

<body style="background:#002b36">
<div style="color:#073642">DarkBlue</div>
<div style="color:#586e75">DarkGreen</div>
<div style="color:#657b83">DarkCyan</div>
<div style="color:#dc322f">DarkRed</div>
<div style="color:#6c71c4">DarkMagenta</div>
</body>

As far as I can tell, that produces colors that exactly match what the Windows Terminal is showing.

@j4james commented on GitHub (Sep 2, 2019): It looks to me like it's cmder that might be getting the color wrong. I suggest you try out those color values in an HTML document with a little test like this: ``` <body style="background:#002b36"> <div style="color:#073642">DarkBlue</div> <div style="color:#586e75">DarkGreen</div> <div style="color:#657b83">DarkCyan</div> <div style="color:#dc322f">DarkRed</div> <div style="color:#6c71c4">DarkMagenta</div> </body> ``` As far as I can tell, that produces colors that exactly match what the Windows Terminal is showing.
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 3, 2019):

It looks like ConEmu does some cool stuff to make sure that a color can always be perceived. It bumps colors that could be invisible on a certain background up in perceptibility using the deltaE 2000 algorithm.

@DHowett-MSFT commented on GitHub (Sep 3, 2019): It looks like ConEmu does some [cool stuff](https://github.com/Maximus5/ConEmu/blob/44fb97de59e663d9e81fafa31d95b0fe18c5a2fb/src/ConEmu/ColorFix.cpp#L488) to make sure that a color can always be _perceived_. It bumps colors that could be invisible on a certain background up in perceptibility using the [deltaE 2000](http://zschuessler.github.io/DeltaE/learn/) algorithm.
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 3, 2019):

It looks like ConEmu lets you configure that with its "Adjust lightness of indistinguishable text" option. I'm betting that if you turn it off, you'll see the same colors as in WT.

@DHowett-MSFT commented on GitHub (Sep 3, 2019): It looks like ConEmu lets you configure that with its "Adjust lightness of indistinguishable text" option. I'm betting that if you turn it off, you'll see the same colors as in WT.
Author
Owner

@kojoru commented on GitHub (Sep 3, 2019):

@DHowett fair enough! Should I then open a new issue to feature request the same in terminal or can we convert this one?

@kojoru commented on GitHub (Sep 3, 2019): @DHowett fair enough! Should I then open a new issue to feature request the same in terminal or can we convert this one?
Author
Owner

@WSLUser commented on GitHub (Sep 3, 2019):

It would be pretty cool if we could do the same for Terminal. I had wondered why color output looked a bit different. Thanks for breaking it down @DHowett .

@WSLUser commented on GitHub (Sep 3, 2019): It would be pretty cool if we could do the same for Terminal. I had wondered why color output looked a bit different. Thanks for breaking it down @DHowett .
Author
Owner

@hectormz commented on GitHub (May 22, 2020):

What would be needed/considered to implement this in Terminal?

@hectormz commented on GitHub (May 22, 2020): What would be needed/considered to implement this in Terminal?
Author
Owner

@DHowett commented on GitHub (May 22, 2020):

All it would need is someone to do the work, and two people to review the pull request. 😄

I'd prefer to see a specification to answer a couple questions: would this happen during rendering? Color scheme loading? Is there somewhere we could, should cache colors? How do we hook this setting up into the layer it needs to go into? Should we nudge rgb or 256-color entries the same way as user-specified ones?

@DHowett commented on GitHub (May 22, 2020): All it would need is someone to do the work, and two people to review the pull request. :smile: I'd prefer to see a specification to answer a couple questions: would this happen during rendering? Color scheme loading? Is there somewhere we could, should cache colors? How do we hook this setting up into the layer it needs to go into? Should we nudge rgb or 256-color entries the same way as user-specified ones?
Author
Owner

@hectormz commented on GitHub (May 22, 2020):

Three very easy things 😅

I can't answer any of the specifics regarding how this or WT actually work.

This would only pertain to foreground/background compatibility right?

But I would happy be with just user-specified colors.

Nudging 256 color entries would be nice if it wasn't much more overhead, and was cached ahead of time. But looking beyond the scope of user-specified colors might cause this fix to grow too much.

For example, opacity or background images would mess up these adjustments, so I don't think that should be supported/fixed.

@hectormz commented on GitHub (May 22, 2020): Three very easy things 😅 I can't answer any of the specifics regarding how this or WT actually work. This would only pertain to foreground/background compatibility right? But I would happy be with just user-specified colors. Nudging 256 color entries would be nice if it wasn't much more overhead, and was cached ahead of time. But looking beyond the scope of user-specified colors might cause this fix to grow too much. For example, opacity or background images would mess up these adjustments, so I don't think that should be supported/fixed.
Author
Owner

@CIPop commented on GitHub (Jun 10, 2020):

+1 on this. To avoid others wasting their time:

Solarized Dark is not supported on Terminal today (assuming that most people like to see what they are typing).
@DHowett was kind enough to suggest workarounds in #6424 if you're hitting these issues.

@CIPop commented on GitHub (Jun 10, 2020): +1 on this. To avoid others wasting their time: `Solarized Dark` is _not_ supported on Terminal today (assuming that most people like to see what they are typing). @DHowett was kind enough to suggest workarounds in #6424 if you're hitting these issues.
Author
Owner

@kojoru commented on GitHub (Jun 12, 2020):

@CIPop I've been quite successfully using my patched version of Solarized (John Doe) snatched from ConEmu ever since I filed this issue. It goes as follows:

        {   
            "white" : "#fdf6e3",
            "blue" : "#0B5669",
            "green" : "#586e75",
            "cyan" : "#657b83",
            "red" : "#dc322f",
            "purple" : "#6c71c4",
            "yellow" : "#cb4b16",
            "brightWhite" : "#eee8d5",
            "brightBlack" : "#93a1a1",
            "brightBlue" : "#268bd2",
            "brightGreen" : "#859900",
            "brightCyan" : "#2aa198",
            "brightRed" : "#839496",
            "brightPurple" : "#d33682",
            "brightYellow" : "#b58900",
            "black" : "#002B36",
            "background" : "#002B36",
            "foreground" : "#fdf6e3",
            "name" : "Solarized (John Doe with contrast blue)"
        }

As compared to the built-in Solarized, it never produces any unreadable results and has decent difference between colors.
image

@kojoru commented on GitHub (Jun 12, 2020): @CIPop I've been quite successfully using my patched version of `Solarized (John Doe)` snatched from ConEmu ever since I filed this issue. It goes as follows: ``` { "white" : "#fdf6e3", "blue" : "#0B5669", "green" : "#586e75", "cyan" : "#657b83", "red" : "#dc322f", "purple" : "#6c71c4", "yellow" : "#cb4b16", "brightWhite" : "#eee8d5", "brightBlack" : "#93a1a1", "brightBlue" : "#268bd2", "brightGreen" : "#859900", "brightCyan" : "#2aa198", "brightRed" : "#839496", "brightPurple" : "#d33682", "brightYellow" : "#b58900", "black" : "#002B36", "background" : "#002B36", "foreground" : "#fdf6e3", "name" : "Solarized (John Doe with contrast blue)" } ``` As compared to the built-in Solarized, it never produces any unreadable results and has decent difference between colors. ![image](https://user-images.githubusercontent.com/1836172/84491344-b20c8380-aca4-11ea-83d8-c123529ba2d9.png)
Author
Owner

@WSLUser commented on GitHub (Jun 12, 2020):

@kojoru I suggest sending a PR updating the default with this instead.

@WSLUser commented on GitHub (Jun 12, 2020): @kojoru I suggest sending a PR updating the default with this instead.
Author
Owner

@kojoru commented on GitHub (Jun 12, 2020):

Fair enough! Will do.

@kojoru commented on GitHub (Jun 12, 2020): Fair enough! Will do.
Author
Owner

@WSLUser commented on GitHub (Jun 12, 2020):

This may help for anyone trying to implement this: http://www.easyrgb.com/en/math.php#text6. I got this website from the answer in https://stackoverflow.com/questions/5774152/calculate-how-humans-perceive-similarity-between-different-colours. We use chromium math functions in C++ so it just needs conversion to use that instead.

@WSLUser commented on GitHub (Jun 12, 2020): This may help for anyone trying to implement this: http://www.easyrgb.com/en/math.php#text6. I got this website from the answer in https://stackoverflow.com/questions/5774152/calculate-how-humans-perceive-similarity-between-different-colours. We use chromium math functions in C++ so it just needs conversion to use that instead.
Author
Owner

@ghost commented on GitHub (Oct 20, 2021):

:tada:This issue was addressed in #11095, which has now been successfully released as Windows Terminal Preview v1.12.2922.0.🎉

Handy links:

@ghost commented on GitHub (Oct 20, 2021): :tada:This issue was addressed in #11095, which has now been successfully released as `Windows Terminal Preview v1.12.2922.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.12.2922.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3713