Skip to content

[illusion] The color name in profiles.json does not match the actual color #852

@SwimmingTiger

Description

@SwimmingTiger

In conclusion:

To confirm the following issue, I installed Ubuntu and ran my script and get the same color output as Windows Terminal.

It seems that I am completely wrong. What I have always obtained through cmd-colors-solarized is not the real Solarized Dark.


Your Windows build number

Windows 10 version 1903 build 18895.1000

What you're doing and what's happening

I have always used the solarized dark scheme provided by cmd-colors-solarized in system ConHost and it works well.

I want to port this scheme to Windows Terminal, so I have this in profiles.json (It is only a small difference from the Solarized Dark scheme that comes with the project):

{
    "name": "Solarized Dark CMD",
    "foreground": "#839496",
    "background": "#002B36",
    "black": "#073642",
    "red": "#DC322F",
    "green": "#859900",
    "yellow": "#B58900",
    "blue": "#268BD2",
    "purple": "#D33682",
    "cyan": "#2AA198",
    "white": "#EEE8D5",
    "brightBlack": "#002B36",
    "brightRed": "#CB4B16",
    "brightGreen": "#586E75",
    "brightYellow": "#657B83",
    "brightBlue": "#839496",
    "brightPurple": "#6C71C4",
    "brightCyan": "#93A1A1",
    "brightWhite": "#FDF6E3"
}

However, I got a completely different color than expected. The same color scheme works quite well in Windows Console (Preview) (importing via solarized-dark.reg).

The following script can show the difference between the two:

#!/bin/bash

# solarized ansicolors (exporting for grins)
export base03='\033[0;30;40m'
export base02='\033[1;30;40m'
export base01='\033[0;32;40m'
export base00='\033[0;33;40m'
export base0='\033[0;34;40m'
export base1='\033[0;36;40m'
export base2='\033[0;37;40m'
export base3='\033[1;37;40m'
export yellow='\033[1;33;40m'
export orange='\033[0;31;40m'
export red='\033[1;31;40m'
export magenta='\033[1;35;40m'
export violet='\033[0;35;40m'
export blue='\033[1;34;40m'
export cyan='\033[1;36;40m'
export green='\033[1;32;40m'
export reset='\033[0m'

colors () {
  echo -e "base03  ${base03}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base02  ${base02}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base01  ${base01}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base00  ${base00}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base0   ${base0}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base1   ${base1}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base2   ${base2}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "base3   ${base3}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "yellow  ${yellow}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "orange  ${orange}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "red     ${red}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "magenta ${magenta}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "violet  ${violet}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "blue    ${blue}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "cyan    ${cyan}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
  echo -e "green   ${green}Test ▅▅▅▅▅▅▅▅▅▅▅$reset"
}

colors

before fix

What's wrong / what should be happening instead:

I got the following form through a color picker:

name Expected color Windows Terminal
(Actual color)
Windows Console
(Actual color)
base03 #002B36 (brightBlack) #073642 (black) #002B36 (brightBlack)
base02 #073642 (black) #002B36 (brightBlack) #073642 (black)
base01 #586E75 (brightGreen) #859900 (green) #586E75 (brightGreen)
base00 #657B83 (brightYellow) #B58900 (yellow) #657B83 (brightYellow)
base0 #839496 (brightBlue) #268BD2 (blue) #839496 (brightBlue)
base1 #93A1A1 (brightCyan) #2AA198 (cyan) #93A1A1 (brightCyan)
base2 #EEE8D5 (white) #839496 (brightBlue) #EEE8D5 (white)
base3 #FDF6E3 (brightWhite) #FDF6E3 (brightWhite) #FDF6E3 (brightWhite)
yellow #B58900 (yellow) #657B83 (brightYellow) #B58900 (yellow)
orange #CB4B16 (brightRed) #DC322F (red) #CB4B16 (brightRed)
red #DC322F (red) #CB4B16 (brightRed) #DC322F (red)
magenta #D33682 (purple) #6C71C4 (brightPurple) #D33682 (purple)
violet #6C71C4 (brightPurple) #D33682 (purple) #6C71C4 (brightPurple)
blue #268BD2 (blue) #839496 (brightBlue) #268BD2 (blue)
cyan #2AA198 (cyan) #93A1A1 (brightCyan) #2AA198 (cyan)
green #859900 (green) #586E75 (brightGreen) #859900 (green)

So you can see two problems:

  1. Windows Terminal's understanding of ANSI escape sequences is different from ConHost. The colors and their bright colors are reversed in Windows Terminal.
  2. base2='\033[0;37;40m' and blue='\033[1;34;40m' have the same actual color in Windows Terminal, one should be wrong. There are no identical colors in the scheme.

Based on issue 1, I made the following fix (Exchange colors with their bright colors):

{
    "name": "Solarized Dark CMD Fix",
    "foreground": "#839496",
    "background": "#002B36",
    "black": "#002B36",
    "red": "#CB4B16",
    "green": "#586E75",
    "yellow": "#657B83",
    "blue": "#839496",
    "purple": "#6C71C4",
    "cyan": "#93A1A1",
    "white": "#EEE8D5",
    "brightBlack": "#073642",
    "brightRed": "#DC322F",
    "brightGreen": "#859900",
    "brightYellow": "#B58900",
    "brightBlue": "#268BD2",
    "brightPurple": "#D33682",
    "brightCyan": "#2AA198",
    "brightWhite": "#FDF6E3"
}

However, I can't fix the base2 because it uses the same color as another VT (it looks like same as base0 at this time):

after fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions