terminal/src/tools/ColorTool
John Azariah 436fac6afa
fix scheme name resolution, and schema load on WSL (#5327)
This PR fixes the scheme resolution bug outlined in #5326

The approach is as follows:

* In [SchemeManager.cs], find the first scheme parser that actually
  successfully parses the scheme, as opposed to the existing code, which
  finds the first scheme parser which _says it can parse the scheme_, as
  that logic spuriously returns `true` currently. 
* In [XmlSchemeParser.cs] and [JsonParser.cs], ensure that the contents
  of the file are read and the contents passed to XmlDocument.LoadXXX,
  as this fails with an UriException on WSL otherwise.
* Remove `CanParse` as it is superfluous. The check for a valid scheme
  parser should not just check an extension but also if the file exists
  - this is best done by the `ParseScheme` function as it already
  returns null on failure.
* Add `FileExtension` to the interface because we need it lifted now.

Closes #5326
2020-07-01 20:15:09 +00:00
..
ColorTool fix scheme name resolution, and schema load on WSL (#5327) 2020-07-01 20:15:09 +00:00
schemes Improve default foregrounds for Tango schemes (#5598) 2020-04-27 15:20:02 -07:00
signing Update SignConfig to use SHA2 variant per governance request. (#2802) 2019-09-19 09:27:42 -07:00
all.bat Move ColorTool to src/ (#422) 2019-04-30 12:27:06 -07:00
build.bat ColorTool: Proofread the helper text, update Build.bat (#2644) 2019-12-03 12:44:23 -08:00
ColorTool.sln Move ColorTool to src/ (#422) 2019-04-30 12:27:06 -07:00
LICENSE Move ColorTool to src/ (#422) 2019-04-30 12:27:06 -07:00
README.md ColorTool: Proofread the helper text, update Build.bat (#2644) 2019-12-03 12:44:23 -08:00
ThirdPartyNotices.md Add the Tango color schemes for Terminal and ColorTool (#5305) 2020-04-14 10:47:02 -07:00

ColorTool

ColorTool makes it easy to change the Windows console to your desired scheme. Includes support for iTerm themes!

Usage:
    ColorTool.exe <Function>
    ColorTool.exe [Options] <Scheme name>

ColorTool is a utility for helping to set the color palette of the Windows Console.
By default, applies the colors in the specified .itermcolors, .json or .ini file to the current console window.
This does NOT save the properties automatically. For that, you'll need to open the properties sheet and hit "Ok".
Included should be a `schemes/` directory with a selection of schemes of both formats for examples.
Feel free to add your own preferred scheme to that directory.

Parameters:
    <Function>   : One and only one of the switches listed in the "Functions" section below.
    <Scheme name>: The name of a color scheme. ColorTool will try to first load it as an .ini file color scheme
                   If that fails, it will look for it as a .json file color scheme
                   If that fails, it will look for it as an .itermcolors file color scheme.
                   Must be the last parameter passed to ColorTool.
    [Option]     : One or more of the switches listed in the "Options" section below. Must appear before scheme
                   name.

Functions:
    You may specify only one of the following switches each time you invoke ColorTool. Any additional switches
    before or after the first one of them will be ignored.

    -?, --help     : Display this help message
    -c, --current  : Print the color table for the currently applied scheme
    -v, --version  : Display the version number
    -l, --location : Displays the full path to the schemes directory
    -s, --schemes  : Displays all available schemes
    -o, --output <filename> : output the current color table to a file in .ini format

Options:
    You may use these switches before a scheme name.

    -q, --quiet    : Don't print the color table after applying
    -e, --errors   : Report scheme parsing errors on the console
    -d, --defaults : Apply the scheme to only the defaults in the registry
                     By default, the scheme would be applied to the current console instead.
    -b, --both     : Apply the scheme to both the current console and the defaults.
                     By default, the scheme would be applied to the current console only.
    -x, --xterm    : Set the colors using VT sequences. Used for setting the colors in WSL.
                     Only works in Windows versions >= 17048.
    -t, --terminal : Output the colors in JSON format for copying into a Windows Terminal settings file.

Included Schemes

Included are two important color schemes in .ini file format: cmd-legacy and campbell.

  • cmd-legacy is the legacy color scheme of the Windows Console, before July 2017
  • campbell is the new default scheme used by the Windows Console Host, as of the Fall Creator's Update.

There are a few other schemes in that directory in both .ini format and .itermcolors.

Adding Schemes

You can also add color schemes to the ColorTool easily. Take any existing scheme in .itermcolors format, and paste it in the schemes/ directory. Or just cd into a directory containing *.itermcolors files before running the ColorTool.

I recommend the excellent iTerm2-Color-Schemes repo, which has TONS of schemes to choose from, and previews.

You can also easily visually edit .itermcolors color schemes using terminal.sexy. Use the Import and Export tabs with iTerm2 as the format.

Installing

Just download the latest ColorTool release and extract the zip file.

Building

Either build with Visual Studio, or use the included build.bat from the command line to try and auto-detect your MSBuild version.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.