Why does PowerShell display "DarkYellow" text improperly?
Lee Holmes' blog post, PowerShell's Noble Blue, talks about this a bit, but doesn't actually explain why DarkYellow was changed. Most likely the default DarkYellow was unreadable with the blue background.
As you've probably figured out - the System.ConsoleColor is slightly misnamed as it doesn't actually specify a color, it specifies an index into a color table which can be modified by shortcuts. This is unfortunately a limitation of the console subsystem.
If you change the shortcut PowerShell.lnk, you'll be changing the colors only for yourself and only when you start PowerShell from that link. If you use Start | Run, or say run cmd, then run PowerShell from cmd, you'll get different settings.
Lee's blog post should give you enough hints to get the behavior you prefer.
I don't have the exact answers, but I have something that kind of works! I did some research (thanks, Jason Shirk) and found that System.ConsoleColor
is just an index into the color table, which must be represented by this
The documentation does mention that DarkYellow
is supposed to be "ochre" (RGB: 204, 119, 34).
| DarkYellow | The color dark yellow (ochre). |
Choose "Defaults" from the application's top-left window menu and you'll see the generic "Console Windows Properties" (like above), which will modify any ConsoleWindowClass
type window.
Pick the "Screen Text" option and you'll notice it's set to use the value in DarkYellow
's spot. I don't know why they didn't use Gray
or DarkGray
right next to it! Click on the 7th box (the index for DarkYellow
) and change it to ochre's RGB value. Then, set the "Screen Text" to the Gray
or DarkGray
(unless you really want ochre foreground text by default).
All of your Command Prompt, PowerShell, and Git Bash (mingw) consoles will be changed (mine were).
I did have a little trouble with the PowerShell prompt from the "run" dialog. It took the colors, but not some of my other settings (physical and buffer size, etc). I ended up using scoop
to install concfg
PS> scoop install concfgPS> scoop install sudo
and exported my good console settings
PS> concfg export > ~\.consolerc
and imported them into my misbehaving prompt with prejudice (you can use sudo
, also from scoop, or just launch an admin prompt)
PS> sudo concfg import ~\.consolerc
And, actually, concfg seemed to export everything, the color table values and the selections! Here's a partial dump of my configuration (the color parts)
{ "popup_colors": "cyan,white", "dark_gray": "#808080", "screen_colors": "gray,dark_magenta", "dark_green": "#008000", "blue": "#0000ff", "dark_yellow": "#cc7722", "red": "#ff0000", "magenta": "#ff00ff", "dark_red": "#800000", "yellow": "#ffff00", "dark_magenta": "#012456", "cyan": "#00ffff", "green": "#00ff00", "dark_blue": "#000080", "gray": "#c0c0c0", "white": "#ffffff", "black": "#000000", "dark_cyan": "#008080"}