├── cmd-dark.png ├── cmd-light.png ├── cmd-default.png ├── .gitattributes ├── ansi.sh ├── windows-defaults.reg ├── colors.sh ├── Update-Link.ps1 ├── Set-SolarizedLightColorDefaults.ps1 ├── Set-SolarizedDarkColorDefaults.ps1 ├── Out-Colors.ps1 ├── solarized-dark.reg ├── solarized-light.reg ├── .gitignore ├── README.md └── Get-Link.ps1 /cmd-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanselman/cmd-colors-solarized/master/cmd-dark.png -------------------------------------------------------------------------------- /cmd-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanselman/cmd-colors-solarized/master/cmd-light.png -------------------------------------------------------------------------------- /cmd-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanselman/cmd-colors-solarized/master/cmd-default.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # For this project 2 | *.ps1 text eol=crlf 3 | *.reg text eol=crlf 4 | *.sh text eol=lf 5 | -------------------------------------------------------------------------------- /ansi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ansicolors () { 5 | for attr in 0 1 4 7; do 6 | echo "------------------------------------------------" 7 | printf "ESC[%s;Foreground;Background - \n" $attr 8 | for fore in 30 31 32 33 34 35 36 37; do 9 | for back in 40 41 42 43 44 45 46 47; do 10 | printf '\033[%s;%s;%sm %02s;%02s\033[0m' $attr $fore $back $fore $back 11 | done 12 | printf '\n' 13 | done 14 | printf '\033[0m' 15 | done 16 | } 17 | 18 | ansicolors 19 | -------------------------------------------------------------------------------- /windows-defaults.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CURRENT_USER\Console] 4 | "ColorTable00"=dword:00000000 5 | "ColorTable01"=dword:00800000 6 | "ColorTable02"=dword:00008000 7 | "ColorTable03"=dword:00808000 8 | "ColorTable04"=dword:00000080 9 | "ColorTable05"=dword:00800080 10 | "ColorTable06"=dword:00008080 11 | "ColorTable07"=dword:00c0c0c0 12 | "ColorTable08"=dword:00808080 13 | "ColorTable09"=dword:00ff0000 14 | "ColorTable10"=dword:0000ff00 15 | "ColorTable11"=dword:00ffff00 16 | "ColorTable12"=dword:000000ff 17 | "ColorTable13"=dword:00ff00ff 18 | "ColorTable14"=dword:0000ffff 19 | "ColorTable15"=dword:00ffffff 20 | "ScreenColors"=dword:00000007 21 | "PopupColors"=dword:000000f5 22 | -------------------------------------------------------------------------------- /colors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # solarized ansicolors (exporting for grins) 4 | export base03='\033[0;30;40m' 5 | export base02='\033[1;30;40m' 6 | export base01='\033[0;32;40m' 7 | export base00='\033[0;33;40m' 8 | export base0='\033[0;34;40m' 9 | export base1='\033[0;36;40m' 10 | export base2='\033[0;37;40m' 11 | export base3='\033[1;37;40m' 12 | export yellow='\033[1;33;40m' 13 | export orange='\033[0;31;40m' 14 | export red='\033[1;31;40m' 15 | export magenta='\033[1;35;40m' 16 | export violet='\033[0;35;40m' 17 | export blue='\033[1;34;40m' 18 | export cyan='\033[1;36;40m' 19 | export green='\033[1;32;40m' 20 | export reset='\033[0m' 21 | 22 | colors () { 23 | echo -e "base03 ${base03}Test$reset" 24 | echo -e "base02 ${base02}Test$reset" 25 | echo -e "base01 ${base01}Test$reset" 26 | echo -e "base00 ${base00}Test$reset" 27 | echo -e "base0 ${base0}Test$reset" 28 | echo -e "base1 ${base1}Test$reset" 29 | echo -e "base2 ${base2}Test$reset" 30 | echo -e "base3 ${base3}Test$reset" 31 | echo -e "yellow ${yellow}Test$reset" 32 | echo -e "orange ${orange}Test$reset" 33 | echo -e "red ${red}Test$reset" 34 | echo -e "magenta ${magenta}Test$reset" 35 | echo -e "violet ${violet}Test$reset" 36 | echo -e "blue ${blue}Test$reset" 37 | echo -e "cyan ${cyan}Test$reset" 38 | echo -e "green ${green}Test$reset" 39 | } 40 | 41 | colors 42 | -------------------------------------------------------------------------------- /Update-Link.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [Parameter(Mandatory=$true)] 3 | [ValidateScript({Test-Path $_})] 4 | [string]$Path, 5 | 6 | [Parameter()] 7 | [ValidateSet('Light','Dark')] 8 | [string]$Theme = 'Dark' 9 | ) 10 | 11 | $lnk = & ("$PSScriptRoot\Get-Link.ps1") $Path 12 | 13 | # Set Common Solarized Colors 14 | $lnk.ConsoleColors[0]="#002b36" 15 | $lnk.ConsoleColors[8]="#073642" 16 | $lnk.ConsoleColors[2]="#586e75" 17 | $lnk.ConsoleColors[6]="#657b83" 18 | $lnk.ConsoleColors[1]="#839496" 19 | $lnk.ConsoleColors[3]="#93a1a1" 20 | $lnk.ConsoleColors[7]="#eee8d5" 21 | $lnk.ConsoleColors[15]="#fdf6e3" 22 | $lnk.ConsoleColors[14]="#b58900" 23 | $lnk.ConsoleColors[4]="#cb4b16" 24 | $lnk.ConsoleColors[12]="#dc322f" 25 | $lnk.ConsoleColors[13]="#d33682" 26 | $lnk.ConsoleColors[5]="#6c71c4" 27 | $lnk.ConsoleColors[9]="#268bd2" 28 | $lnk.ConsoleColors[11]="#2aa198" 29 | $lnk.ConsoleColors[10]="#859900" 30 | 31 | # Set Light/Dark Theme-Specific Colors 32 | if ($Theme -eq "Dark") { 33 | $lnk.PopUpBackgroundColor=0xf 34 | $lnk.PopUpTextColor=0x6 35 | $lnk.ScreenBackgroundColor=0x0 36 | $lnk.ScreenTextColor=0x1 37 | } else { 38 | $lnk.PopUpBackgroundColor=0x0 39 | $lnk.PopUpTextColor=0x1 40 | $lnk.ScreenBackgroundColor=0xf 41 | $lnk.ScreenTextColor=0x6 42 | } 43 | 44 | $lnk.Save() 45 | 46 | Write-Host "Updated $Path to Solarized - $Theme" -------------------------------------------------------------------------------- /Set-SolarizedLightColorDefaults.ps1: -------------------------------------------------------------------------------- 1 | # Host Foreground 2 | $Host.PrivateData.ErrorForegroundColor = 'Red' 3 | $Host.PrivateData.WarningForegroundColor = 'Yellow' 4 | $Host.PrivateData.DebugForegroundColor = 'Green' 5 | $Host.PrivateData.VerboseForegroundColor = 'Blue' 6 | $Host.PrivateData.ProgressForegroundColor = 'Gray' 7 | 8 | # Host Background 9 | $Host.PrivateData.ErrorBackgroundColor = 'Gray' 10 | $Host.PrivateData.WarningBackgroundColor = 'Gray' 11 | $Host.PrivateData.DebugBackgroundColor = 'Gray' 12 | $Host.PrivateData.VerboseBackgroundColor = 'Gray' 13 | $Host.PrivateData.ProgressBackgroundColor = 'Cyan' 14 | 15 | # Check for PSReadline 16 | if (Get-Module -ListAvailable -Name "PSReadline") { 17 | $options = Get-PSReadlineOption 18 | 19 | # Foreground 20 | $options.CommandForegroundColor = 'Yellow' 21 | $options.ContinuationPromptForegroundColor = 'DarkYellow' 22 | $options.DefaultTokenForegroundColor = 'DarkYellow' 23 | $options.EmphasisForegroundColor = 'Cyan' 24 | $options.ErrorForegroundColor = 'Red' 25 | $options.KeywordForegroundColor = 'Green' 26 | $options.MemberForegroundColor = 'DarkGreen' 27 | $options.NumberForegroundColor = 'DarkGreen' 28 | $options.OperatorForegroundColor = 'DarkCyan' 29 | $options.ParameterForegroundColor = 'DarkCyan' 30 | $options.StringForegroundColor = 'Blue' 31 | $options.TypeForegroundColor = 'DarkBlue' 32 | $options.VariableForegroundColor = 'Green' 33 | 34 | # Background 35 | $options.CommandBackgroundColor = 'White' 36 | $options.ContinuationPromptBackgroundColor = 'White' 37 | $options.DefaultTokenBackgroundColor = 'White' 38 | $options.EmphasisBackgroundColor = 'White' 39 | $options.ErrorBackgroundColor = 'White' 40 | $options.KeywordBackgroundColor = 'White' 41 | $options.MemberBackgroundColor = 'White' 42 | $options.NumberBackgroundColor = 'White' 43 | $options.OperatorBackgroundColor = 'White' 44 | $options.ParameterBackgroundColor = 'White' 45 | $options.StringBackgroundColor = 'White' 46 | $options.TypeBackgroundColor = 'White' 47 | $options.VariableBackgroundColor = 'White' 48 | } 49 | -------------------------------------------------------------------------------- /Set-SolarizedDarkColorDefaults.ps1: -------------------------------------------------------------------------------- 1 | # Host Foreground 2 | $Host.PrivateData.ErrorForegroundColor = 'Red' 3 | $Host.PrivateData.WarningForegroundColor = 'Yellow' 4 | $Host.PrivateData.DebugForegroundColor = 'Green' 5 | $Host.PrivateData.VerboseForegroundColor = 'Blue' 6 | $Host.PrivateData.ProgressForegroundColor = 'Gray' 7 | 8 | # Host Background 9 | $Host.PrivateData.ErrorBackgroundColor = 'DarkGray' 10 | $Host.PrivateData.WarningBackgroundColor = 'DarkGray' 11 | $Host.PrivateData.DebugBackgroundColor = 'DarkGray' 12 | $Host.PrivateData.VerboseBackgroundColor = 'DarkGray' 13 | $Host.PrivateData.ProgressBackgroundColor = 'Cyan' 14 | 15 | # Check for PSReadline 16 | if (Get-Module -ListAvailable -Name "PSReadline") { 17 | $options = Get-PSReadlineOption 18 | 19 | # Foreground 20 | $options.CommandForegroundColor = 'Yellow' 21 | $options.ContinuationPromptForegroundColor = 'DarkBlue' 22 | $options.DefaultTokenForegroundColor = 'DarkBlue' 23 | $options.EmphasisForegroundColor = 'Cyan' 24 | $options.ErrorForegroundColor = 'Red' 25 | $options.KeywordForegroundColor = 'Green' 26 | $options.MemberForegroundColor = 'DarkCyan' 27 | $options.NumberForegroundColor = 'DarkCyan' 28 | $options.OperatorForegroundColor = 'DarkGreen' 29 | $options.ParameterForegroundColor = 'DarkGreen' 30 | $options.StringForegroundColor = 'Blue' 31 | $options.TypeForegroundColor = 'DarkYellow' 32 | $options.VariableForegroundColor = 'Green' 33 | 34 | # Background 35 | $options.CommandBackgroundColor = 'Black' 36 | $options.ContinuationPromptBackgroundColor = 'Black' 37 | $options.DefaultTokenBackgroundColor = 'Black' 38 | $options.EmphasisBackgroundColor = 'Black' 39 | $options.ErrorBackgroundColor = 'Black' 40 | $options.KeywordBackgroundColor = 'Black' 41 | $options.MemberBackgroundColor = 'Black' 42 | $options.NumberBackgroundColor = 'Black' 43 | $options.OperatorBackgroundColor = 'Black' 44 | $options.ParameterBackgroundColor = 'Black' 45 | $options.StringBackgroundColor = 'Black' 46 | $options.TypeBackgroundColor = 'Black' 47 | $options.VariableBackgroundColor = 'Black' 48 | } 49 | -------------------------------------------------------------------------------- /Out-Colors.ps1: -------------------------------------------------------------------------------- 1 | #Requires -Version 3 2 | 3 | # Map the Solarized colors to their ColorTable pairings 4 | $SolarizedPallet = [ordered]@{ 5 | 'base03' = 'Black' 6 | 'base02' = 'DarkGray' 7 | 'base01' = 'DarkGreen' 8 | 'base00' = 'DarkYellow' 9 | 'base0' = 'DarkBlue' 10 | 'base1' = 'DarkCyan' 11 | 'base2' = 'Gray' 12 | 'base3' = 'White' 13 | 'yellow' = 'Yellow' 14 | 'orange' = 'DarkRed' 15 | 'red' = 'Red' 16 | 'magenta' = 'Magenta' 17 | 'violet' = 'DarkMagenta' 18 | 'blue' = 'Blue' 19 | 'cyan' = 'Cyan' 20 | 'green' = 'Green' 21 | } 22 | $PalletSolarized = @{} # Will be used to invert the mapping 23 | 24 | Write-Host 25 | 26 | # Try and use the default background color to identify the installed theme 27 | $BackgroundColor = switch ($HOST.UI.RawUI.BackgroundColor.ToString()) { 28 | 'DarkMagenta' {'DarkMagenta'} # None 29 | 'White' {'Gray'} # Light 30 | 'Black' {'DarkGray'} # Dark 31 | } 32 | 33 | # Draw table of Solarized mappings 34 | Write-Host ("{0,-15} | {1,-15} | {2,-15}" -f "Solarized", "Light", "Dark") -BackgroundColor $BackgroundColor 35 | $SolarizedPallet.keys | ` 36 | ForEach-Object { 37 | Write-Host ("{0,-15}" -f $_) -BackgroundColor $BackgroundColor -NoNewline 38 | Write-Host (" | " -f $_) -BackgroundColor $BackgroundColor -NoNewline 39 | Write-Host ("{0,-15}" -f $SolarizedPallet[$_]) -NoNewline ` 40 | -ForegroundColor $SolarizedPallet[$_] ` 41 | -BackgroundColor 'White' 42 | Write-Host (" | " -f $_) -BackgroundColor $BackgroundColor -NoNewline 43 | Write-Host ("{0,-15}" -f $SolarizedPallet[$_]) ` 44 | -ForegroundColor $SolarizedPallet[$_] ` 45 | -BackgroundColor 'Black' 46 | 47 | $PalletSolarized.Add($SolarizedPallet[$_], $_) # Create the inverted map 48 | } 49 | 50 | Write-Host 51 | 52 | $Colors = [Enum]::GetValues( [System.ConsoleColor] ) 53 | 54 | # Draw table of ColorTable mappings 55 | Write-Host ("{0,-15} | {1,-15} | {2,-15}" -f "Color Table", "Light", "Dark") -BackgroundColor $BackgroundColor 56 | $Colors | ` 57 | ForEach-Object {$i=0}{ 58 | Write-Host ("{0,-11} [{1:X}]" -f $_.ToString(), $i++) -BackgroundColor $BackgroundColor -NoNewline 59 | Write-Host (" | " -f $_.ToString()) -BackgroundColor $BackgroundColor -NoNewline 60 | Write-Host ("{0,-15}" -f $PalletSolarized[$_.ToString()]) -NoNewline ` 61 | -ForegroundColor $_.ToString() ` 62 | -BackgroundColor 'White' 63 | Write-Host (" | " -f $_.ToString()) -BackgroundColor $BackgroundColor -NoNewline 64 | Write-Host ("{0,-15}" -f $PalletSolarized[$_.ToString()]) ` 65 | -ForegroundColor $_.ToString() ` 66 | -BackgroundColor 'Black' 67 | } 68 | 69 | Write-Host 70 | -------------------------------------------------------------------------------- /solarized-dark.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Registry file that maps the solarized palette to the 16 avaliable colors 4 | ; in a Windows command prompt. Note, hex values in the table are RGB but byte 5 | ; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00 6 | ; 7 | ; Solarized color table from http://ethanschoonover.com/solarized. 8 | ; 9 | ;| SOLARIZED | HEX | ANSI | TERMCOL | cmd.exe | PowerShell | ColorTable | DWORD | 10 | ;|-----------|---------|-----------|-----------|-------------|-------------|------------|----------| 11 | ;| base03 | #002b36 | ESC[0;30m | brblack | Black | Black | 00 | 00362b00 | 12 | ;| base02 | #073642 | ESC[1;30m | black | Gray | DarkGray | 08 | 00423607 | 13 | ;| base01 | #586e75 | ESC[0;32m | brgreen | Green | DarkGreen | 02 | 00756e58 | 14 | ;| base00 | #657b83 | ESC[0;33m | bryellow | Yellow | DarkYellow | 06 | 00837b65 | 15 | ;| base0 | #839496 | ESC[0;34m | brblue | Blue | DarkBlue | 01 | 00969483 | 16 | ;| base1 | #93a1a1 | ESC[0;36m | brcyan | Aqua | DarkCyan | 03 | 00a1a193 | 17 | ;| base2 | #eee8d5 | ESC[0;37m | white | White | Gray | 07 | 00d5e8ee | 18 | ;| base3 | #fdf6e3 | ESC[1;37m | brwhite | BrightWhite | White | 15 | 00e3f6fd | 19 | ;| yellow | #b58900 | ESC[1;33m | yellow | LightYellow | Yellow | 14 | 000089b5 | 20 | ;| orange | #cb4b16 | ESC[0;31m | brred | Red | DarkRed | 04 | 00164bcb | 21 | ;| red | #dc322f | ESC[1;31m | red | LightRed | Red | 12 | 002f32dc | 22 | ;| magenta | #d33682 | ESC[1;35m | magenta | LightPurple | Magenta | 13 | 008236d3 | 23 | ;| violet | #6c71c4 | ESC[0;35m | brmagenta | Purple | DarkMagenta | 05 | 00c4716c | 24 | ;| blue | #268bd2 | ESC[1;34m | blue | LightBlue | Blue | 09 | 00d28b26 | 25 | ;| cyan | #2aa198 | ESC[1;36m | cyan | LightAqua | Cyan | 11 | 0098a12a | 26 | ;| green | #859900 | ESC[1;32m | green | LightGreen | Green | 10 | 00009985 | 27 | ; 28 | 29 | [HKEY_CURRENT_USER\Console] 30 | "ColorTable00"=dword:00362b00 31 | "ColorTable01"=dword:00969483 32 | "ColorTable02"=dword:00756e58 33 | "ColorTable03"=dword:00a1a193 34 | "ColorTable04"=dword:00164bcb 35 | "ColorTable05"=dword:00c4716c 36 | "ColorTable06"=dword:00837b65 37 | "ColorTable07"=dword:00d5e8ee 38 | "ColorTable08"=dword:00423607 39 | "ColorTable09"=dword:00d28b26 40 | "ColorTable10"=dword:00009985 41 | "ColorTable11"=dword:0098a12a 42 | "ColorTable12"=dword:002f32dc 43 | "ColorTable13"=dword:008236d3 44 | "ColorTable14"=dword:000089b5 45 | "ColorTable15"=dword:00e3f6fd 46 | "ScreenColors"=dword:00000001 47 | "PopupColors"=dword:000000f6 48 | -------------------------------------------------------------------------------- /solarized-light.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Registry file that maps the solarized palette to the 16 avaliable colors 4 | ; in a Windows command prompt. Note, hex values in the table are RGB but byte 5 | ; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00 6 | ; 7 | ; Solarized color table from http://ethanschoonover.com/solarized. 8 | ; 9 | ;| SOLARIZED | HEX | ANSI | TERMCOL | cmd.exe | PowerShell | ColorTable | DWORD | 10 | ;|-----------|---------|-----------|-----------|-------------|-------------|------------|----------| 11 | ;| base03 | #002b36 | ESC[0;30m | brblack | Black | Black | 00 | 00362b00 | 12 | ;| base02 | #073642 | ESC[1;30m | black | Gray | DarkGray | 08 | 00423607 | 13 | ;| base01 | #586e75 | ESC[0;32m | brgreen | Green | DarkGreen | 02 | 00756e58 | 14 | ;| base00 | #657b83 | ESC[0;33m | bryellow | Yellow | DarkYellow | 06 | 00837b65 | 15 | ;| base0 | #839496 | ESC[0;34m | brblue | Blue | DarkBlue | 01 | 00969483 | 16 | ;| base1 | #93a1a1 | ESC[0;36m | brcyan | Aqua | DarkCyan | 03 | 00a1a193 | 17 | ;| base2 | #eee8d5 | ESC[0;37m | white | White | Gray | 07 | 00d5e8ee | 18 | ;| base3 | #fdf6e3 | ESC[1;37m | brwhite | BrightWhite | White | 15 | 00e3f6fd | 19 | ;| yellow | #b58900 | ESC[1;33m | yellow | LightYellow | Yellow | 14 | 000089b5 | 20 | ;| orange | #cb4b16 | ESC[0;31m | brred | Red | DarkRed | 04 | 00164bcb | 21 | ;| red | #dc322f | ESC[1;31m | red | LightRed | Red | 12 | 002f32dc | 22 | ;| magenta | #d33682 | ESC[1;35m | magenta | LightPurple | Magenta | 13 | 008236d3 | 23 | ;| violet | #6c71c4 | ESC[0;35m | brmagenta | Purple | DarkMagenta | 05 | 00c4716c | 24 | ;| blue | #268bd2 | ESC[1;34m | blue | LightBlue | Blue | 09 | 00d28b26 | 25 | ;| cyan | #2aa198 | ESC[1;36m | cyan | LightAqua | Cyan | 11 | 0098a12a | 26 | ;| green | #859900 | ESC[1;32m | green | LightGreen | Green | 10 | 00009985 | 27 | ; 28 | 29 | [HKEY_CURRENT_USER\Console] 30 | "ColorTable00"=dword:00362b00 31 | "ColorTable01"=dword:00969483 32 | "ColorTable02"=dword:00756e58 33 | "ColorTable03"=dword:00a1a193 34 | "ColorTable04"=dword:00164bcb 35 | "ColorTable05"=dword:00c4716c 36 | "ColorTable06"=dword:00837b65 37 | "ColorTable07"=dword:00d5e8ee 38 | "ColorTable08"=dword:00423607 39 | "ColorTable09"=dword:00d28b26 40 | "ColorTable10"=dword:00009985 41 | "ColorTable11"=dword:0098a12a 42 | "ColorTable12"=dword:002f32dc 43 | "ColorTable13"=dword:008236d3 44 | "ColorTable14"=dword:000089b5 45 | "ColorTable15"=dword:00e3f6fd 46 | "ScreenColors"=dword:000000f6 47 | "PopupColors"=dword:00000001 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio Code 34 | ################# 35 | 36 | # User-specific files 37 | .vscode/ 38 | 39 | 40 | ################# 41 | ## Visual Studio 42 | ################# 43 | 44 | ## Ignore Visual Studio temporary files, build results, and 45 | ## files generated by popular Visual Studio add-ons. 46 | 47 | # User-specific files 48 | *.suo 49 | *.user 50 | *.sln.docstates 51 | 52 | # Build results 53 | [Dd]ebug/ 54 | [Rr]elease/ 55 | *_i.c 56 | *_p.c 57 | *.ilk 58 | *.meta 59 | *.obj 60 | *.pch 61 | *.pdb 62 | *.pgc 63 | *.pgd 64 | *.rsp 65 | *.sbr 66 | *.tlb 67 | *.tli 68 | *.tlh 69 | *.tmp 70 | *.vspscc 71 | .builds 72 | *.dotCover 73 | 74 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 75 | #packages/ 76 | 77 | # Visual C++ cache files 78 | ipch/ 79 | *.aps 80 | *.ncb 81 | *.opensdf 82 | *.sdf 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper* 90 | 91 | # Installshield output folder 92 | [Ee]xpress 93 | 94 | # DocProject is a documentation generator add-in 95 | DocProject/buildhelp/ 96 | DocProject/Help/*.HxT 97 | DocProject/Help/*.HxC 98 | DocProject/Help/*.hhc 99 | DocProject/Help/*.hhk 100 | DocProject/Help/*.hhp 101 | DocProject/Help/Html2 102 | DocProject/Help/html 103 | 104 | # Click-Once directory 105 | publish 106 | 107 | # Others 108 | [Bb]in 109 | [Oo]bj 110 | sql 111 | TestResults 112 | *.Cache 113 | ClientBin 114 | stylecop.* 115 | ~$* 116 | *.dbmdl 117 | Generated_Code #added for RIA/Silverlight projects 118 | 119 | # Backup & report files from converting an old project file to a newer 120 | # Visual Studio version. Backup files are not needed, because we have git ;-) 121 | _UpgradeReport_Files/ 122 | Backup*/ 123 | UpgradeLog*.XML 124 | 125 | 126 | 127 | ############ 128 | ## Windows 129 | ############ 130 | 131 | # Windows image file caches 132 | Thumbs.db 133 | 134 | # Folder config file 135 | Desktop.ini 136 | 137 | 138 | ############# 139 | ## Python 140 | ############# 141 | 142 | *.py[co] 143 | 144 | # Packages 145 | *.egg 146 | *.egg-info 147 | dist 148 | build 149 | eggs 150 | parts 151 | bin 152 | var 153 | sdist 154 | develop-eggs 155 | .installed.cfg 156 | 157 | # Installer logs 158 | pip-log.txt 159 | 160 | # Unit test / coverage reports 161 | .coverage 162 | .tox 163 | 164 | #Translations 165 | *.mo 166 | 167 | #Mr Developer 168 | .mr.developer.cfg 169 | 170 | # Mac crap 171 | .DS_Store 172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Solarized - Command Prompt theme 2 | ============================================= 3 | 4 | This is a [Solarized][1] color scheme for the Windows command prompt, 5 | with major contributions by Neil Pankey and Ryan Beesley. 6 | 7 | See the [Solarized home page][1] for screenshots and more details, 8 | as well as color schemes for other applications. To contribute or file bug 9 | reports or issues, please visit [the GitHub repo for this port][2], 10 | or the main [Solarized repository][3]. 11 | 12 | Inspired by this [post][4] 13 | 14 | Making Solarized work for cmd.exe, Bash on Ubuntu on Windows, and PowerShell, 15 | and striking a balance with how other Solarized projects are implemented 16 | presents some challenges. The following table shows how the colors are mapped. 17 | 18 | | SOLARIZED | HEX | ANSI | TERMCOL | cmd.exe | PowerShell | ColorTable | DWORD | 19 | |-----------|---------|-----------|-----------|-------------|-------------|------------|----------| 20 | | base03 | #002b36 | ESC[0;30m | brblack | Black | Black | 00 | 00362b00 | 21 | | base02 | #073642 | ESC[1;30m | black | Gray | DarkGray | 08 | 00423607 | 22 | | base01 | #586e75 | ESC[0;32m | brgreen | Green | DarkGreen | 02 | 00756e58 | 23 | | base00 | #657b83 | ESC[0;33m | bryellow | Yellow | DarkYellow | 06 | 00837b65 | 24 | | base0 | #839496 | ESC[0;34m | brblue | Blue | DarkBlue | 01 | 00969483 | 25 | | base1 | #93a1a1 | ESC[0;36m | brcyan | Aqua | DarkCyan | 03 | 00a1a193 | 26 | | base2 | #eee8d5 | ESC[0;37m | white | White | Gray | 07 | 00d5e8ee | 27 | | base3 | #fdf6e3 | ESC[1;37m | brwhite | BrightWhite | White | 15 | 00e3f6fd | 28 | | yellow | #b58900 | ESC[1;33m | yellow | LightYellow | Yellow | 14 | 000089b5 | 29 | | orange | #cb4b16 | ESC[0;31m | brred | Red | DarkRed | 04 | 00164bcb | 30 | | red | #dc322f | ESC[1;31m | red | LightRed | Red | 12 | 002f32dc | 31 | | magenta | #d33682 | ESC[1;35m | magenta | LightPurple | Magenta | 13 | 008236d3 | 32 | | violet | #6c71c4 | ESC[0;35m | brmagenta | Purple | DarkMagenta | 05 | 00c4716c | 33 | | blue | #268bd2 | ESC[1;34m | blue | LightBlue | Blue | 09 | 00d28b26 | 34 | | cyan | #2aa198 | ESC[1;36m | cyan | LightAqua | Cyan | 11 | 0098a12a | 35 | | green | #859900 | ESC[1;32m | green | LightGreen | Green | 10 | 00009985 | 36 | 37 | To make sure that the terminal is likely to use the best matching, the 38 | ColorTable is aligned with TERMCOL values. These values were pulled from PuTTY 39 | and other Solarized terminal profiles. This allows the same ANSI escape 40 | sequences to show the same in ANSI supported terminals. The PowerShell default 41 | colors are also matched for the $Host.PrivateData and PSReadLine to make them 42 | seemingly fit with the rest of the environments. 43 | 44 | WARNING 45 | ------- 46 | 47 | Below are very simplified installation instructions. It **will not** update 48 | existing shortcuts because they have their own color mapping. It **will not** 49 | always play nice with traditional unix tools or compatability shims because 50 | Windows uses a fundamentally different color code mapping. 51 | 52 | Installation 53 | ------------ 54 | 55 | Import the `.reg` file of choice, e.g. `regedit /s solarized-dark.reg`. 56 | 57 | Both files contain the same palettes, the only difference is the default 58 | foreground and background colors. Therefore you can switch between themes on 59 | the fly with `color 01` for dark and `color F6` for light. 60 | 61 | Copy the `Set-Solarized*ColorDefaults.ps1` files to your profile directory, 62 | likely `~\Documents\WindowsPowerShell\`. Then add the following line of code 63 | to the end of your `Microsoft.PowerShell_profile.ps1` or `profile.ps1`: 64 | 65 | . (Join-Path -Path (Split-Path -Parent -Path $PROFILE) -ChildPath $(switch($HOST.UI.RawUI.BackgroundColor.ToString()){'White'{'Set-SolarizedLightColorDefaults.ps1'}'Black'{'Set-SolarizedDarkColorDefaults.ps1'}default{return}})) 66 | 67 | Uninstall 68 | ------------ 69 | 70 | The file `windows-defaults.reg` is provided to restore the command prompt 71 | colors back to their shipping defaults. The registry settings have been 72 | checked for versions of Windows back to at least Windows 7 and the values are 73 | the same. 74 | 75 | To restore the defaults, import the `.reg` the same way as you applied it 76 | previously, `regedit /s windows-defaults.reg`. You will also want to revert 77 | any changes you made to your PowerShell profile. 78 | 79 | Screenshots 80 | ------------ 81 | 82 | ![Dark prompt][5] 83 | 84 | ![Light prompt][6] 85 | 86 | [1]: http://ethanschoonover.com/solarized 87 | [2]: https://github.com/neilpa/cmd-colors-solarized 88 | [3]: https://github.com/altercation/solarized 89 | [4]: https://github.com/altercation/solarized/issues/127 90 | [5]: https://cdn.rawgit.com/shanselman/cmd-colors-solarized/09cd1e95/cmd-dark.png 91 | [6]: https://cdn.rawgit.com/shanselman/cmd-colors-solarized/09cd1e95/cmd-light.png 92 | -------------------------------------------------------------------------------- /Get-Link.ps1: -------------------------------------------------------------------------------- 1 | param([Parameter(ValueFromPipelineByPropertyName=$true)][Alias("PSPath")][string]$Path) 2 | begin { 3 | 4 | Add-Type -TypeDef @" 5 | using System; 6 | using System.IO; 7 | using System.Text; 8 | using System.Drawing; 9 | using System.Runtime.InteropServices; 10 | using System.Runtime.InteropServices.ComTypes; 11 | 12 | namespace Huddled.Interop 13 | { 14 | [Flags()] // SHELL_LINK_DATA_FLAGS 15 | public enum ShellLinkFlags : uint { 16 | Default = 0x00000000, 17 | HasIdList = 0x00000001, 18 | HasLinkInfo = 0x00000002, 19 | HasName = 0x00000004, 20 | HasRelpath = 0x00000008, 21 | HasWorkingdir = 0x00000010, 22 | HasArgs = 0x00000020, 23 | HasIconLocation = 0x00000040, 24 | Unicode = 0x00000080, 25 | ForceNoLinkInfo = 0x00000100, 26 | HasExpSz = 0x00000200, 27 | RunInSeparate = 0x00000400, 28 | HasLogo3Id = 0x00000800, 29 | HasDarwinId = 0x00001000, 30 | RunasUser = 0x00002000, 31 | HasExpIconSz = 0x00004000, 32 | NoPidlAlias = 0x00008000, 33 | ForceUncname = 0x00010000, 34 | RunWithShimlayer = 0x00020000, 35 | ForceNoLinktrack = 0x00040000, 36 | EnableTargetMetadata = 0x00080000, 37 | DisableLinkPathTracking = 0x00100000, 38 | DisableKnownfolderRelativeTracking = 0x00200000, 39 | NoKFAlias = 0x00400000, 40 | AllowLinkToLink = 0x00800000, 41 | UnaliasOnSave = 0x01000000, 42 | PreferEnvironmentPath = 0x02000000, 43 | KeepLocalIdListForUncTarget = 0x04000000, 44 | Valid = 0x07fff7ff, 45 | Reserved = (uint)0x80000000 46 | } 47 | 48 | 49 | // IShellLink.ShowCmd fFlags 50 | [Flags()] 51 | public enum ShowCmd 52 | { 53 | Normal = 1, 54 | Maximized = 3, 55 | Minnoactive = 7 56 | } 57 | 58 | // IShellLink.Resolve fFlags SLR_FLAGS 59 | [Flags()] 60 | public enum ResolveFlags 61 | { 62 | NoUI = 0x1, 63 | AnyMatch = 0x2, 64 | Update = 0x4, 65 | NoUpdate = 0x8, 66 | NoSearch = 0x10, 67 | NoTrack = 0x20, 68 | NoLinkInfo = 0x40, 69 | InvokeMsi = 0x80 70 | } 71 | 72 | // IShellLink.GetPath fFlags SLGP_FLAGS 73 | [Flags()] 74 | public enum GetPathFlags 75 | { 76 | ShortPath = 0x1, 77 | UncPriority = 0x2, 78 | RawPath = 0x4 79 | } 80 | 81 | // Win32 COORD 82 | [StructLayout(LayoutKind.Sequential)] 83 | public struct COORD 84 | { 85 | public short X; 86 | public short Y; 87 | } 88 | 89 | // IShellDataLink NT_CONSOLE_PROPS 90 | [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 91 | public struct NT_CONSOLE_PROPS 92 | { 93 | public int cbSize; // Size of this extra data block 94 | public uint dwSignature; // signature of this extra data block 95 | public ushort wFillAttribute; // fill attribute for console 96 | public ushort wPopupFillAttribute; // fill attribute for console popups 97 | public COORD dwScreenBufferSize; // screen buffer size for console 98 | public COORD dwWindowSize; // window size for console 99 | public COORD dwWindowOrigin; // window origin for console 100 | public int nFont; 101 | public int nInputBufferSize; 102 | public COORD dwFontSize; 103 | public uint uFontFamily; 104 | public uint uFontWeight; 105 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] 106 | public string FaceName; 107 | public uint uCursorSize; 108 | public bool bFullScreen; 109 | public bool bQuickEdit; 110 | public bool bInsertMode; 111 | public bool bAutoPosition; 112 | public uint uHistoryBufferSize; 113 | public uint uNumberOfHistoryBuffers; 114 | public bool bHistoryNoDup; 115 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 116 | public uint[] ColorTable; 117 | } 118 | 119 | // The CharSet must match the CharSet of the corresponding PInvoke signature 120 | [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] 121 | public struct WIN32_FIND_DATA 122 | { 123 | public uint dwFileAttributes; 124 | public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime; 125 | public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime; 126 | public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime; 127 | public uint nFileSizeHigh; 128 | public uint nFileSizeLow; 129 | public uint dwReserved0; 130 | public uint dwReserved1; 131 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)] 132 | public string cFileName; 133 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)] 134 | public string cAlternateFileName; 135 | } 136 | 137 | 138 | [ComImport(), 139 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown), 140 | Guid("0000010B-0000-0000-C000-000000000046")] 141 | public interface IPersistFile 142 | { 143 | #region Methods inherited from IPersist 144 | 145 | void GetClassID( 146 | out Guid pClassID); 147 | 148 | #endregion 149 | 150 | [PreserveSig()] 151 | int IsDirty(); 152 | 153 | void Load( 154 | [MarshalAs(UnmanagedType.LPWStr)] string pszFileName, 155 | int dwMode); 156 | 157 | void Save( 158 | [MarshalAs(UnmanagedType.LPWStr)] string pszFileName, 159 | [MarshalAs(UnmanagedType.Bool)] bool fRemember); 160 | 161 | void SaveCompleted( 162 | [MarshalAs(UnmanagedType.LPWStr)] string pszFileName); 163 | 164 | void GetCurFile( 165 | out IntPtr ppszFileName); 166 | 167 | } 168 | 169 | [ComImport(), 170 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown), 171 | Guid("000214F9-0000-0000-C000-000000000046")] 172 | public interface IShellLinkW 173 | { 174 | void GetPath( 175 | [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, 176 | int cchMaxPath, 177 | out WIN32_FIND_DATA pfd, 178 | GetPathFlags fFlags); 179 | 180 | void GetIDList( 181 | out IntPtr ppidl); 182 | 183 | void SetIDList( 184 | IntPtr pidl); 185 | 186 | void GetDescription( 187 | [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, 188 | int cchMaxName); 189 | 190 | void SetDescription( 191 | [MarshalAs(UnmanagedType.LPWStr)] string pszName); 192 | 193 | void GetWorkingDirectory( 194 | [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, 195 | int cchMaxPath); 196 | 197 | void SetWorkingDirectory( 198 | [MarshalAs(UnmanagedType.LPWStr)] string pszDir); 199 | 200 | void GetArguments( 201 | [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, 202 | int cchMaxPath); 203 | 204 | void SetArguments( 205 | [MarshalAs(UnmanagedType.LPWStr)] string pszArgs); 206 | 207 | void GetHotkey( 208 | out short pwHotkey); 209 | 210 | void SetHotkey( 211 | short wHotkey); 212 | 213 | void GetShowCmd( 214 | out int piShowCmd); 215 | 216 | void SetShowCmd( 217 | int iShowCmd); 218 | 219 | void GetIconLocation( 220 | [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, 221 | int cchIconPath, 222 | out int piIcon); 223 | 224 | void SetIconLocation( 225 | [MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, 226 | int iIcon); 227 | 228 | void SetRelativePath( 229 | [MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, 230 | int dwReserved); 231 | 232 | void Resolve( 233 | IntPtr hwnd, 234 | ResolveFlags fFlags); 235 | 236 | void SetPath( 237 | [MarshalAs(UnmanagedType.LPWStr)] string pszFile); 238 | 239 | } 240 | 241 | [ComImport(), 242 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown), 243 | Guid("45E2b4AE-B1C3-11D0-B92F-00A0C90312E1")] 244 | public interface IShellLinkDataList 245 | { 246 | void AddDataBlock(IntPtr pDataBlock); 247 | 248 | void CopyDataBlock(uint dwSig, out IntPtr ppDataBlock); 249 | 250 | void RemoveDataBlock(uint dwSig); 251 | 252 | void GetFlags(out uint dwFlags); 253 | 254 | void SetFlags(uint dwFlags); 255 | } 256 | 257 | public class ShellLink 258 | { 259 | private IShellLinkW _ShellLink; 260 | private NT_CONSOLE_PROPS _ConsoleProperties; 261 | private ushort _ScreenFill; 262 | private ushort _PopUpFill; 263 | 264 | public Color[] ConsoleColors = new Color[16]; 265 | 266 | public ShellLink(string Path) { 267 | _ShellLink = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00021401-0000-0000-C000-000000000046"))) as IShellLinkW; 268 | if (File.Exists(Path)) 269 | { 270 | IntPtr pConsoleProperties = IntPtr.Zero; 271 | ((IPersistFile)_ShellLink).Load(Path, 0); 272 | 273 | try 274 | { 275 | // TODO: Fix memory leak here 276 | ((IShellLinkDataList)_ShellLink).CopyDataBlock(0xA0000002, out pConsoleProperties); 277 | _ConsoleProperties = (NT_CONSOLE_PROPS)Marshal.PtrToStructure(pConsoleProperties, typeof(NT_CONSOLE_PROPS)); 278 | _ScreenFill = _ConsoleProperties.wFillAttribute; 279 | _PopUpFill = _ConsoleProperties.wPopupFillAttribute; 280 | 281 | for (int i = 0; i < 16; i++) 282 | { 283 | ConsoleColors[i] = ColorTranslator.FromWin32((int)_ConsoleProperties.ColorTable[i]); 284 | } 285 | } 286 | catch (Exception) 287 | { 288 | } 289 | 290 | } 291 | else 292 | { 293 | ((IPersistFile)_ShellLink).Save(Path, true); 294 | } 295 | 296 | // TODO: Don't fake it, pull these values from the Registry 297 | // Initialize default Console Properties 298 | if (_ConsoleProperties.dwSignature != 0xA0000002) 299 | { 300 | _ConsoleProperties = new NT_CONSOLE_PROPS(); 301 | _ConsoleProperties.cbSize = Marshal.SizeOf(_ConsoleProperties); 302 | _ConsoleProperties.dwSignature = 0xA0000002; 303 | _ConsoleProperties.ColorTable = new uint[16]; 304 | 305 | _ConsoleProperties.dwWindowSize.X = 120; 306 | _ConsoleProperties.dwWindowSize.Y = 30; 307 | 308 | _ConsoleProperties.dwScreenBufferSize.X = 120; 309 | _ConsoleProperties.dwScreenBufferSize.Y = 8000; 310 | 311 | _ConsoleProperties.bQuickEdit = true; 312 | 313 | _ConsoleProperties.bAutoPosition = true; 314 | 315 | for (int i = 0; i < 16; i++) 316 | { 317 | _ConsoleProperties.ColorTable[i] = 0xffffffff; 318 | } 319 | } 320 | } 321 | 322 | public ShellLinkFlags Flags { 323 | get { 324 | uint flags; 325 | ((IShellLinkDataList)_ShellLink).GetFlags( out flags ); 326 | return (ShellLinkFlags)flags; 327 | } 328 | set { 329 | ((IShellLinkDataList)_ShellLink).SetFlags( (uint)value ); 330 | } 331 | } 332 | 333 | public void Save(string Path) 334 | { 335 | SetConsoleColors(); 336 | ((IPersistFile)_ShellLink).Save(Path, true); 337 | } 338 | 339 | public void Save() 340 | { 341 | SetConsoleColors(); 342 | ((IPersistFile)_ShellLink).Save(null, true); 343 | } 344 | 345 | public IShellLinkW GetShellLink() 346 | { 347 | return _ShellLink; 348 | } 349 | 350 | public string Path 351 | { 352 | get 353 | { 354 | StringBuilder sb = new StringBuilder(260); 355 | WIN32_FIND_DATA pfd = new WIN32_FIND_DATA(); 356 | _ShellLink.GetPath(sb, 259, out pfd, GetPathFlags.RawPath); 357 | return sb.ToString(); 358 | } 359 | set 360 | { 361 | _ShellLink.SetPath(value); 362 | } 363 | } 364 | 365 | public string Description 366 | { 367 | get 368 | { 369 | StringBuilder sb = new StringBuilder(2048); 370 | _ShellLink.GetDescription(sb, 2048); 371 | return sb.ToString(); 372 | } 373 | set { _ShellLink.SetDescription(value); } 374 | } 375 | 376 | public string WorkingDirectory 377 | { 378 | get 379 | { 380 | StringBuilder sb = new StringBuilder(260); 381 | _ShellLink.GetWorkingDirectory(sb, 260); 382 | return sb.ToString(); 383 | } 384 | set { _ShellLink.SetWorkingDirectory(value); } 385 | } 386 | 387 | public ShowCmd ShowCmd 388 | { 389 | get 390 | { 391 | int nShowCmd; 392 | _ShellLink.GetShowCmd(out nShowCmd); 393 | return (ShowCmd)Enum.ToObject(typeof(ShowCmd), nShowCmd); 394 | } 395 | set 396 | { 397 | _ShellLink.SetShowCmd((int)value); 398 | } 399 | } 400 | 401 | public bool QuickEditMode 402 | { 403 | get { return _ConsoleProperties.bQuickEdit; } 404 | set { _ConsoleProperties.bQuickEdit = value; } 405 | } 406 | 407 | public bool InsertMode 408 | { 409 | get { return _ConsoleProperties.bInsertMode; } 410 | set { _ConsoleProperties.bInsertMode = value; } 411 | } 412 | 413 | public bool AutoPosition 414 | { 415 | get { return _ConsoleProperties.bAutoPosition; } 416 | set { _ConsoleProperties.bAutoPosition = value; } 417 | } 418 | 419 | public void SetScreenBufferSize(short x, short y) 420 | { 421 | _ConsoleProperties.dwScreenBufferSize.X = x; 422 | _ConsoleProperties.dwScreenBufferSize.Y = y; 423 | } 424 | 425 | public void SetWindowSize(short x, short y) 426 | { 427 | _ConsoleProperties.dwWindowSize.X = x; 428 | _ConsoleProperties.dwWindowSize.Y = y; 429 | } 430 | 431 | public uint CommandHistoryBufferSize 432 | { 433 | get { return _ConsoleProperties.uHistoryBufferSize; } 434 | set { _ConsoleProperties.uHistoryBufferSize = value; } 435 | } 436 | 437 | public uint CommandHistoryBufferCount 438 | { 439 | get { return _ConsoleProperties.uNumberOfHistoryBuffers; } 440 | set { _ConsoleProperties.uNumberOfHistoryBuffers = value; } 441 | } 442 | 443 | public byte ScreenBackgroundColor 444 | { 445 | set 446 | { 447 | _ScreenFill &= 0x000f; 448 | _ScreenFill += (ushort)(value << 4); 449 | } 450 | } 451 | 452 | public byte ScreenTextColor 453 | { 454 | set 455 | { 456 | _ScreenFill &= 0x00f0; 457 | _ScreenFill += value; 458 | } 459 | } 460 | 461 | public byte PopUpBackgroundColor 462 | { 463 | set 464 | { 465 | _PopUpFill &= 0x000f; 466 | _PopUpFill += (ushort)(value << 4); 467 | } 468 | } 469 | 470 | public byte PopUpTextColor 471 | { 472 | set 473 | { 474 | _PopUpFill &= 0x00f0; 475 | _PopUpFill += value; 476 | } 477 | } 478 | 479 | // This does more than console colors 480 | private void SetConsoleColors() 481 | { 482 | for (int i = 0; i < 16; i++) 483 | { 484 | _ConsoleProperties.ColorTable[i] = (uint)ColorTranslator.ToWin32(ConsoleColors[i]); 485 | } 486 | _ConsoleProperties.wFillAttribute = _ScreenFill; 487 | _ConsoleProperties.wPopupFillAttribute = _PopUpFill; ; 488 | 489 | IntPtr pConsoleProperties = Marshal.AllocCoTaskMem(_ConsoleProperties.cbSize); 490 | Marshal.StructureToPtr(_ConsoleProperties, pConsoleProperties, true); 491 | ((IShellLinkDataList)_ShellLink).RemoveDataBlock(0xA0000002); 492 | ((IShellLinkDataList)_ShellLink).AddDataBlock(pConsoleProperties); 493 | } 494 | } 495 | } 496 | "@ -ReferencedAssemblies System.Drawing 497 | 498 | function global:Get-Link { 499 | param([Parameter(ValueFromPipelineByPropertyName=$true)][Alias("PSPath")][string]$Path) 500 | process { 501 | New-Object Huddled.Interop.ShellLink (Convert-Path $Path) 502 | } 503 | } 504 | 505 | } 506 | process { 507 | Get-Link $Path 508 | } --------------------------------------------------------------------------------