Skip to content

Commit

Permalink
"Color scheme" is two words (microsoft#1054)
Browse files Browse the repository at this point in the history
* Update ColorTool comments

* Update profile key

* Add ability to load settings from old key
  • Loading branch information
ianjfrosst authored and zadjii-msft committed May 30, 2019
1 parent dadd74c commit 71e19cd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
33 changes: 18 additions & 15 deletions src/cascadia/TerminalApp/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ using namespace ::Microsoft::Console;

static constexpr std::wstring_view NAME_KEY{ L"name" };
static constexpr std::wstring_view GUID_KEY{ L"guid" };
static constexpr std::wstring_view COLORSCHEME_KEY{ L"colorscheme" };
static constexpr std::wstring_view COLORSCHEME_KEY{ L"colorScheme" };
static constexpr std::wstring_view COLORSCHEME_KEY_OLD{ L"colorscheme" };

static constexpr std::wstring_view FOREGROUND_KEY{ L"foreground" };
static constexpr std::wstring_view BACKGROUND_KEY{ L"background" };
Expand Down Expand Up @@ -124,7 +125,7 @@ const ColorScheme* _FindScheme(const std::vector<ColorScheme>& schemes,

// Method Description:
// - Create a TerminalSettings from this object. Apply our settings, as well as
// any colors from our colorscheme, if we have one.
// any colors from our color scheme, if we have one.
// Arguments:
// - schemes: a list of schemes to look for our color scheme in, if we have one.
// Return Value:
Expand Down Expand Up @@ -364,23 +365,25 @@ Profile Profile::FromJson(winrt::Windows::Data::Json::JsonObject json)
{
result._schemeName = json.GetNamedString(COLORSCHEME_KEY);
}
else
else if (json.HasKey(COLORSCHEME_KEY_OLD))
{
// TODO: deprecate old settings key
result._schemeName = json.GetNamedString(COLORSCHEME_KEY_OLD);
}
else if (json.HasKey(COLORTABLE_KEY))
{
if (json.HasKey(COLORTABLE_KEY))
const auto table = json.GetNamedArray(COLORTABLE_KEY);
int i = 0;
for (auto v : table)
{
const auto table = json.GetNamedArray(COLORTABLE_KEY);
int i = 0;
for (auto v : table)
if (v.ValueType() == JsonValueType::String)
{
if (v.ValueType() == JsonValueType::String)
{
const auto str = v.GetString();
// TODO: MSFT:20737698 - if this fails, display an approriate error
const auto color = Utils::ColorFromHexString(str.c_str());
result._colorTable[i] = color;
}
i++;
const auto str = v.GetString();
// TODO: MSFT:20737698 - if this fails, display an approriate error
const auto color = Utils::ColorFromHexString(str.c_str());
result._colorTable[i] = color;
}
i++;
}
}
if (json.HasKey(HISTORYSIZE_KEY))
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ColorTool/ColorTool/ColorScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace ColorTool
{
/// <summary>
/// Represents a colorscheme that can be applied to a console.
/// Represents a color scheme that can be applied to a console.
/// </summary>
public class ColorScheme
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ColorTool/ColorTool/ColorTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace ColorTool
{
/// <summary>
/// Displays the color table that demonstrates the current colorscheme.
/// Displays the color table that demonstrates the current color scheme.
/// </summary>
static class ColorTable
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ColorTool/ColorTool/ConsoleAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace ColorTool
{
/// <summary>
/// Keeps track of the color table indices for the background/foreground in a colorscheme.
/// Keeps track of the color table indices for the background/foreground in a color scheme.
/// </summary>
public readonly struct ConsoleAttributes
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ColorTool/ColorTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private static void Version()
}

/// <summary>
/// Returns an enumerable of consoles that we want to apply the colorscheme to.
/// Returns an enumerable of consoles that we want to apply the color scheme to.
/// The contents of this enumerable depends on the user's provided command line flags.
/// </summary>
private static IEnumerable<IConsoleTarget> GetConsoleTargets()
Expand Down

0 comments on commit 71e19cd

Please sign in to comment.