'Powershell Solarized theme not displaying terminal colors correctly

I recently started using powershell to ssh into our Linux app servers where I run Vim, bash, etc. The colors are a bit janky though compared to a standard Linux terminal from a Linux or Mac client. This messes up all the syntax highlighting I've had for my code settings in Vim as well as anything that runs in the bash shell. I've attached a pic showing the color diff between the two terminals.

It looks to me like the Powershell Solarized Dark theme (Settings > Color schemes > Solarized Dark) ignores any ANSI escape codes to set the background color to black and instead applies the Solarized dark background underneath, which really just creates this washed out effect on all the colors.

Can anyone offer some insight how to fix this? Is there a different way of specifying the ANSI codes in the bash shell/Linux terminal to get the Powershell theme to display the color palette the same as Mac and Linux? Maybe some tweak to the Powershell theme?

The script I run for displaying the colors is here:

#!/bin/sh
############################################################
# Nico Golde [email protected] Homepage: http://www.ngolde.de
# Letzte �nderung: Mon Feb 16 16:24:41 CET 2004
############################################################

for attr in 0 1 4 5 7 ; do
    echo "----------------------------------------------------------------"
    printf "ESC[%s;Foreground;Background - \n" $attr
    for fore in 30 31 32 33 34 35 36 37; do
        for back in 40 41 42 43 44 45 46 47; do
            printf '\033[%s;%s;%sm %02s;%02s  ' $attr $fore $back $fore $back
        done
    printf '\n'
    done
    printf '\033[0m'
done

Linux/Powershell colors



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source