ColorTool throwing error "Invalid URI: The hostname could not be parsed." for Microsoft WSL

Windows Subsystem for Linux (WSL) is pretty cool. We've had some good alternatives like Cygwin and virtual machines, but having a Microsoft-supported Linux kernel that runs natively in Windows is a whole other story. If I had a time machine and visited my younger self to tell me about the future, I could talk about neat things like almost self-driving cars, reusable rockets, cryptocurrency, or even an online movement to beat hedge funds in the stock market! My younger self could've believed all these things, but not "Microsoft embraces Linux". Younger self would have branded current me as a bold-faced liar, an imposter!

I've been pleased with WSL thus far.  But the default bash color scheme is horrendous (this isn't necessarily specific to WSL itself, as other Linux native bash shells have similar issues). What I'm talking about are dark colors on a black background, the worst being dark blue on black, and some colored font on a green background. 

I tried Microsoft's Terminal ColorTool.exe, but as of March 2021, the downloadable binary throws an error when you try to run from the WSL Ubuntu shell:


user@user-PC:~/schemes$ ../ColorTool.exe solarized_dark.itermcolors

Unhandled Exception: System.UriFormatException: Invalid URI: The hostname could not be parsed.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri)
   at System.Xml.XmlTextReaderImpl..ctor(String url, XmlNameTable nt)
   at System.Xml.XmlDocument.Load(String filename)
   at ColorTool.SchemeParsers.XmlSchemeParser.LoadXmlScheme(String schemeName)
   at ColorTool.SchemeParsers.XmlSchemeParser.ParseScheme(String schemeName, Boolean reportErrors)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at ColorTool.Program.Main(String[] args)
It does work fine for the Windows cmd.exe (Command Prompt). But this does nothing for the WSL shell. I tried numerous things with .dir_colors/dircolors,  LS_COLORS, and editing the PS1 format in .bashrc, but none of these worked. All of this appeared to be overridden by Microsoft's customizations with the color schemes. There are other ways to make the colors a bit more readable - click the top left of the window and go to Properties.  It does make everything a bit more monochrome.




But if you want real bash colors like you might see on a native Ubuntu install, you'll probably want to try this. I ended up just going with mintty's wsltty - problem solved!




Comments

Popular posts from this blog

Domain registrar pricing comparison (2014)

How to block the Admiral anti ad-block detection message

usoclient.exe in Windows 10 wakes up my PC with Wake Source: Unknown