neilpa / cmd-colors-solarized Goto Github PK
View Code? Open in Web Editor NEWSolarized color settings for Windows command prompt
Solarized color settings for Windows command prompt
When running the script on Windows 7 with the following command:
Update-Link.cmd "c:\users\admin\alias\command.lnk" light
The following error results:
The term '\Get-Link.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Adding a '.' to the path in Update-Link.ps1 fixes the issue temporarily:
$lnk = & ("$PSScriptRoot\Get-Link.ps1") $Path
$lnk = & ("$PSScriptRoot.\Get-Link.ps1") $Path
There is probably a better way of doing this or setting PSScriptRoot to '.'
As title indicates, the REG files cannot be imported. Error is:
Cannot import xxxxx.reg: the script file is not a Registry script. Only binary archives of Registry can be imported via Registry Editor.
I open the file with Sublime Text 3 and found it is encoded with UTF-8 with BOM. I saved it with UTF-8 without BOM and all is fine.
It may has something to do with my OS locale: Spanish (Spain).
This works perfectly for older versions of Ubuntu on Windows, but I can't make it work for the new version (Ubuntu 18.04) that you download from the Windows 10 Store. When you right-click on the app in the start menu, it no longer gives you the option to "open file location". Is there a way to find the link to update for the new version? (Sorry in advance if this isn't the appropriate forum for this question.)
I just installed the solarized theme doing the registry add first, then updated the links, then copied the Set-SolarizedDarkColorDefaults.ps1 to my profile folder, and then added required text to the end of my profile. Everything looked great after running Out-Colors but once I started using it all of the flags for powershell commands are defaulting to the DarkGray for font color. This is making it unreadable for me. I looked in the Set-SolarizedDarkColorDefaults.ps1 but I do not see that being used except for background colors.
PS C:\WINDOWS\system32> git tfs clone $tfs $/IntraWebForms/AmexReporting --branches=all --workspace="c:\repos"
Repeating #14 (comment):
There's a registry key in
HKEY_CURRENT_USER\Console
for%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
which contains entries overriding the registry setting you've imported.You can either delete/rename those keys (
PopupColors
,ScreenColors
and anything starting withColorTable
), or update them to match the registry file you chose (solarized-dark.reg or solarized-light.reg).There's also (on a 64-bit system) a
%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe
key for the 32-bit powershell executable.
This shows up when the background and text colour of a powershell instance started by "Start->Run->powershell", i.e. not via a shortcut, is not affected by the registry file.
We probably need some way of addressing this, either in the documentation or with some kind of install script?
How do I go about uninstalling solarized once I've installed it?
didn't work at the git bash
I don't know how to apply
" Copy the Set-Solarized*ColorDefaults.ps1 files to your profile directory, likely ~\Documents\WindowsPowerShell. Then add the following line of code to the end of your Microsoft.PowerShell_profile.ps1 or profile.ps1:"
to the windows 10 ubuntu bash, i tried to add that to the .bash_profile and .bashrc, but it can't recognize the line..
Something's wrong with either the registry file or the screenshot.
It's pretty clear in the registry file (and the given command color 01
) that "Black" (base03
) should be the background colour.
However, the shown example has Black visible against the background, and "DarkGray" (base02
) is invisible, suggesting that is set as the background colour.
I confirmed against http://ethanschoonover.com/solarized#usage-development that base03
should be the background colour, and base02
is for background highlight, so I suspect the screenshot is incorrect. It also doesn't match the equivalent result in mintty (e.g. https://github.com/mavnn/mintty-colors-solarized)
Setting the following in my profile.ps1 got me much closer to what I expected:
$Host.PrivateData.ErrorBackgroundColor = "DarkGray"
$Host.PrivateData.WarningBackgroundColor = "DarkGray"
$Host.PrivateData.DebugBackgroundColor = "DarkGray"
$Host.PrivateData.VerboseBackgroundColor = "DarkGray"
This is with Windows 10 anniversary edition.
I also noticed that I never get the solid colour blocks demonstrating background colours. I replaced the "`t" with eight spaces, I suspect tabs are see-through in newer PowerShell releases.
One more note, I had to add the following to my profile.ps1, as the default colouring for both Parameters and Operators was "DarkGray":
Set-PSReadlineOption -TokenKind Parameter -ForegroundColor DarkMagenta -BackgroundColor Black
Set-PSReadlineOption -TokenKind Operator -ForegroundColor DarkMagenta -BackgroundColor Black
I also just found https://www.reddit.com/r/PowerShell/comments/4aw3wa/solarized_powershell_console/ which gives Powershell script for updating the colours stored in console shortcuts.
After upgrade from Windows 1709 to 1803, the Ubuntu bash reverted to the original colors. So I run Update-Link.cmd C:\Windows\System32\bash.exe light
again.
But it gave me the following errors.
D:\code\other\cmd-colors-solarized>Update-Link.cmd C:\Windows\System32\bash.exe light
New-Object : Exception calling ".ctor" with "1" argument(s): "Error HRESULT E_FAIL has been returned from a call to a COM component."
At D:\code\other\cmd-colors-solarized\Get-Link.ps1:501 char:4
+ New-Object Huddled.Interop.ShellLink (Convert-Path $Path)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:14 char:1
+ $lnk.ConsoleColors[0]="#002b36"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:15 char:1
+ $lnk.ConsoleColors[8]="#073642"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:16 char:1
+ $lnk.ConsoleColors[2]="#586e75"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:17 char:1
+ $lnk.ConsoleColors[6]="#657b83"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:18 char:1
+ $lnk.ConsoleColors[1]="#839496"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:19 char:1
+ $lnk.ConsoleColors[3]="#93a1a1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:20 char:1
+ $lnk.ConsoleColors[7]="#eee8d5"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:21 char:1
+ $lnk.ConsoleColors[15]="#fdf6e3"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:22 char:1
+ $lnk.ConsoleColors[14]="#b58900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:23 char:1
+ $lnk.ConsoleColors[4]="#cb4b16"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:24 char:1
+ $lnk.ConsoleColors[12]="#dc322f"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:25 char:1
+ $lnk.ConsoleColors[13]="#d33682"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:26 char:1
+ $lnk.ConsoleColors[5]="#6c71c4"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:27 char:1
+ $lnk.ConsoleColors[9]="#268bd2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:28 char:1
+ $lnk.ConsoleColors[11]="#2aa198"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:29 char:1
+ $lnk.ConsoleColors[10]="#859900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
The property 'PopUpBackgroundColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:38 char:5
+ $lnk.PopUpBackgroundColor=0x0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'PopUpTextColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:39 char:5
+ $lnk.PopUpTextColor=0x1
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'ScreenBackgroundColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:40 char:5
+ $lnk.ScreenBackgroundColor=0xf
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'ScreenTextColor' cannot be found on this object. Verify that the property exists and can be set.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:41 char:5
+ $lnk.ScreenTextColor=0x6
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At D:\code\other\cmd-colors-solarized\Update-Link.ps1:44 char:1
+ $lnk.Save()
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Updated C:\Windows\System32\bash.exe to Solarized - light
D:\code\other\cmd-colors-solarized>
I have tried adding the reg file as mentioned in the installation process. I dont see any changes in PowerShell or CommandPrompt after that.
Tried - Solarized Dark
On a clean install of Windows 10 Creators Edition I've installed the solarized-dark theme.
Powershell changes the colour of typed commands based on their context (if they are parameters, for example).
For parameters (words starting with a -
the colour used is too close to the background colour making them practically invisible:
They typed command here is Set-PSReadlineOption -TokenKind parameter -ForegroundColor white
, which happens to be a temporary fix
Hi,
Command Update-link is unknown with my PowerShell. Any idea ?
I got this error: " ObjectNotFound: (Update-Link:String) [], CommandNotFoundException".
I was trying to run the Set-SolarizedDarkColorDefaults.ps1
, but it gave me an error:
The property 'CommandForegroundColor' cannot be found on this object. Verify that the property exists and can be set.
That is because Get-PSReadlineOption returns a different object now and colors are set in a different manner:
[...]
CommandColor : "$([char]0x1b)[93m"
CommentColor : "$([char]0x1b)[32m"
ContinuationPromptColor : "$([char]0x1b)[34m"
DefaultTokenColor : "$([char]0x1b)[34m"
EmphasisColor : "$([char]0x1b)[96m"
ErrorColor : "$([char]0x1b)[91m"
KeywordColor : "$([char]0x1b)[92m"
MemberColor : "$([char]0x1b)[97m"
NumberColor : "$([char]0x1b)[97m"
OperatorColor : "$([char]0x1b)[90m"
ParameterColor : "$([char]0x1b)[90m"
SelectionColor : "$([char]0x1b)[30;44m"
StringColor : "$([char]0x1b)[36m"
TypeColor : "$([char]0x1b)[37m"
VariableColor : "$([char]0x1b)[92m"
The new way to set colors is described here: https://docs.microsoft.com/en-us/powershell/module/psreadline/set-psreadlineoption?view=powershell-6#examples
After applying the dark color scheme (including the registry update) when I open cmd and enter a command, then press the up arrow key, I only get a blank line and not the last command. If I open cmd via Win+R everything is working as it should, and the colors are still solarized (I guess for that case it uses the registry settings and not the updated shortcut .lnk). I reproduced this on two Windows 10 machines.
EDIT: On PowerShell this problem does not appear.
Not really an issue, but was wondering if there exists an easy way to generalize this to arbitrary color scheme.
Great work on this project, by the way!
Noted in passing in #16, https://www.reddit.com/r/PowerShell/comments/4aw3wa/solarized_powershell_console/d1462uo/ links to a Powershell script which can update the colours stored in a shell link.
This'd be really handy for updating the default links in %AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell
After using the light theme, enter the following command and the numeric part will not be echoed.
eg1
curl 12132132 fsd.exe
Hi,
I am using Windows 7, 32 bit. I did regedit /s solarized-dark.reg
and got the beautiful colors in CMD.exe but my PowerShell (v 4.0) still remains the same. When I run the following code:
$Host.PrivateData.DebugBackgroundColor = "Black"
$Host.PrivateData.ErrorBackgroundColor = "Black"
function Out-Colors()
{
[enum]::GetValues([ConsoleColor]) | % {
Write-Host -NoNewLine "$($_.value__) : $_`t"
Write-Host "COLOR`t" -ForegroundColor $_ -NoNewLine
Write-Host "`t" -BackgroundColor $_
}
}
Out-Colors
How can I make my powershell look like the one in your readme.md
It looks like the color mappings in this repo between powershell's colors and ansi color codes do not match those used by powershell's virtual terminal system.
For example, when Write-Host -ForegroundColor Magenta "test"
is executed, powershell's virtual terminal emits ESC[35;1mtest
(also known as brmagenta or High Intensity Magenta). The mapping in the readme file and code lists the mapping as: magenta -> magenta.
Below are the correct mappings in full:
termcol | Powershell |
---|---|
black | Black |
red | DarkRed |
green | DarkGreen |
yellow | DarkYellow |
blue | DarkBlue |
magenta | DarkMagenta |
cyan | DarkCyan |
white | DarkWhite |
brblack | DarkGray |
brred | Red |
brgreen | Green |
bryellow | Yellow |
brblue | Blue |
brmagenta | Magenta |
brcyan | Cyan |
brwhite | White |
Title says it all. Now I'm having this issue:
https://superuser.com/questions/1444057/cmd-not-working-outside-legacy-mode#
After importing the change, i tried to change the color of git status, but it fails. For example, i tried to change by
git config color.status.untracked blue.
The result color is white under solarized dark scheme of cmd. Is there a way to resolve this?
Thanks
These are lovely colours for the command prompt.
However annoyingly (from Windows, nothing to do with these reg files) they don't get copied across to any shortcuts that you create to run the command prompt. I have a 'make me a sandwich' shortcut that opens the command prompt in admin mode.
I spotted that the command prompt registry keys are just child keys of the main Console
key.
So for my shortcut that I named 'Make me a sandwich' you just have to edit the specified key in the
reg file to:
[HKEY_CURRENT_USER\Console\Make me a sandwich]
anyone tried
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.