neilpa / cmd-colors-solarized

Solarized color settings for Windows command prompt
1.11k stars 176 forks source link

Not work on Windows 1803 #36

Open liudonghua123 opened 6 years ago

liudonghua123 commented 6 years ago

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>
liudonghua123 commented 6 years ago

I can update link the following way successfully. Update-Link.cmd "C:\Users\Liu.D.H\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Bash on Ubuntu on Windows.lnk" light

tstopak commented 6 years ago

Getting this error as well when trying to update Powershell Colors. Mine reads similar:


New-Object : Exception calling ".ctor" with "1" argument(s): "Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Get-Link.ps1:501 char:4
+    New-Object Huddled.Interop.ShellLink (Convert-Path $Path)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInv
   ocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Po
   werShell.Commands.NewObjectCommand

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:14 char:1
+ $lnk.ConsoleColors[0]="#002b36"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:15 char:1
+ $lnk.ConsoleColors[8]="#073642"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:16 char:1
+ $lnk.ConsoleColors[2]="#586e75"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:17 char:1
+ $lnk.ConsoleColors[6]="#657b83"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:18 char:1
+ $lnk.ConsoleColors[1]="#839496"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:19 char:1
+ $lnk.ConsoleColors[3]="#93a1a1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:20 char:1
+ $lnk.ConsoleColors[7]="#eee8d5"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:21 char:1
+ $lnk.ConsoleColors[15]="#fdf6e3"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:22 char:1
+ $lnk.ConsoleColors[14]="#b58900"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:23 char:1
+ $lnk.ConsoleColors[4]="#cb4b16"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:24 char:1
+ $lnk.ConsoleColors[12]="#dc322f"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:25 char:1
+ $lnk.ConsoleColors[13]="#d33682"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:26 char:1
+ $lnk.ConsoleColors[5]="#6c71c4"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:27 char:1
+ $lnk.ConsoleColors[9]="#268bd2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:28 char:1
+ $lnk.ConsoleColors[11]="#2aa198"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\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 C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:33 char:5
+     $lnk.PopUpBackgroundColor=0xf
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'PopUpTextColor' cannot be found on this object. Verify that
the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:34 char:5
+     $lnk.PopUpTextColor=0x6
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenBackgroundColor' cannot be found on this object. Verify
that the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:35 char:5
+     $lnk.ScreenBackgroundColor=0x0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'ScreenTextColor' cannot be found on this object. Verify that
the property exists and can be set.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:36 char:5
+     $lnk.ScreenTextColor=0x1
+     ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\Tommy\svn\cmd-colors-solarized\trunk\Update-Link.ps1:44 char:1
+ $lnk.Save()
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull 

Going to investigate this more in the next day or two. Will post back here if I find anything

DavidRGriswold commented 6 years ago

I Assume this is because PSReadLine has been updated to version 2.0.0. I was not able to find enough documentation in my limited time to understand how to fix this script, but that seems like the necessary next step.

https://www.powershellgallery.com/packages/PSReadLine/2.0.0-beta2

mildronize commented 6 years ago

Firstly, I got error as same with you

PS C:\Users\mildronize\Desktop\cmd-colors-solarized-master> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
+  CurrentUser    RemoteSigned
 LocalMachine       Undefined

I think It depends on your ExecutionPolicy. In my case, I use RemoteSigned on CurrentUser

So, I need to unblock all ps1 files that involves with this script powershell

Here is a file list that I already unblocked, (or other files you wish to run on your computer)

Get-Link.ps1
Update-Link.ps1
Set-SolarizedDarkColorDefaults.ps1
Set-SolarizedLightColorDefaults.ps1

P.S. Update-Link.ps1 will call Get-Link.ps1. So, Get-Link.ps1 should have a permission to run too

Or you can use other ExecutionPolicy for unblocking everything (I don't recommend) Here is my result 2

And my Windows 10 Pro version is 1803 I hope it should be work for you too, have fun 👍

DavidRGriswold commented 6 years ago

I ended reverting away from these tools entirely and using the Windows 10 colortool from https://github.com/Microsoft/console/tree/master/tools/ColorTool instead. It has solarized themes built in and is supported by MS directly so hopefully won't get broken. I'm not sure the scheme is quite as accurate, but it's good enough for me!

On Tue, Sep 18, 2018 at 11:28 PM Thada Wangthammang < notifications@github.com> wrote:

Firstly, I got error as same with you

PS C:\Users\mildronize\Desktop\cmd-colors-solarized-master> Get-ExecutionPolicy -List

    Scope ExecutionPolicy
    ----- ---------------

MachinePolicy Undefined UserPolicy Undefined Process Undefined+ CurrentUser RemoteSigned LocalMachine Undefined

I think It depends on your ExecutionPolicy. In my case, I use RemoteSigned on CurrentUser

So, I need to unblock all ps1 files that involves with this script [image: powershell] https://user-images.githubusercontent.com/3647850/45727363-9d917900-bbed-11e8-9e63-1d4a9e03fc02.PNG

Here is a file list that I already unblocked, (or other files you wish to run on your computer)

Get-Link.ps1 Update-Link.ps1 Set-SolarizedDarkColorDefaults.ps1 Set-SolarizedLightColorDefaults.ps1

P.S. Update-Link.ps1 will call Get-Link.ps1. So, Get-Link.ps1 should have a permission to run too

Or you can use other ExecutionPolicy for unblocking everything (I don't recommend) Here is my result [image: 2] https://user-images.githubusercontent.com/3647850/45727495-2f00eb00-bbee-11e8-890a-14128c41a8dc.PNG

And my Windows 10 Pro version is 1803 I hope it should be work for you too, have fun 👍

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neilpa/cmd-colors-solarized/issues/36#issuecomment-422626698, or mute the thread https://github.com/notifications/unsubscribe-auth/ATpU7yei8znqOVVOjsjP3vPTEYKrITLVks5ucavNgaJpZM4T9CRz .

rbeesley commented 5 years ago

There's a lot changing with respect to how the Windows 10 console works. I think if you are using Windows 10, the colortool is probably the right approach. With the colortool, you can modify it so the colors match the same as what this project tried to. As I recall the colortool scheme is slightly different in some shades, but in some ways it might be an improvement. Long term, the approach used with these scripts probably won't work with the new Terminal as it (thankfully) applies schemes in a different way. I think colortool might still work with it. You can find a few builds that people have made to experiment with. This project will remain applicable to the classical conhost terminal and shells, such as running cmd or PowerShell today, but it will hopefully be retired as the primary terminal window most people use in the next few releases. If you haven't seen it yet, look for the YouTube video announcing it at Build.

ColorTool is in a slightly different place now: https://github.com/microsoft/terminal/tree/master/src/tools/ColorTool

stefaanc commented 5 years ago

I had similar issues. The issue seems to be that the PSReadLine module doesn't like any changes to the properties of a shortcut via the Get-Link script

It would be very bad if they moved to the colortool, because it does not provide all the features of the the old Get-Link script. As for the new Terminal,... we will see when it comes.

Anyways, the solution is to downgrade the PSReadLine module to version 1.2. The 2.0.0-beta versions that ship with Windows 10 are really causing lots of issues and are far from stable. Have a look here for detailed instructions: https://github.com/stefaanc/psconsole#the-colors-of-the-console