Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add one half color schemes #466

Merged
merged 4 commits into from
May 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 66 additions & 4 deletions src/cascadia/TerminalApp/CascadiaSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,69 @@ ColorScheme _CreateCampbellScheme()
return campbellScheme;
}

ColorScheme _CreateSolarizedDarkScheme()
ColorScheme _CreateOneHalfDarkScheme()
{
// First 8 dark colors per: https://github.com/sonph/onehalf/blob/master/putty/onehalf-dark.reg
// Dark gray is per colortool scheme, the other 7 of the last 8 colors from the colortool
// scheme are the same as their dark color equivalents.
ColorScheme oneHalfDarkScheme { L"One Half Dark",
RGB(220, 223, 228),
RGB( 40, 44, 52) };
auto& oneHalfDarkTable = oneHalfDarkScheme.GetTable();
auto oneHalfDarkSpan = gsl::span<COLORREF>(&oneHalfDarkTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
oneHalfDarkTable[0] = RGB( 40, 44, 52); // black
oneHalfDarkTable[1] = RGB(224, 108, 117); // dark red
oneHalfDarkTable[2] = RGB(152, 195, 121); // dark green
oneHalfDarkTable[3] = RGB(229, 192, 123); // dark yellow
oneHalfDarkTable[4] = RGB( 97, 175, 239); // dark blue
oneHalfDarkTable[5] = RGB(198, 120, 221); // dark magenta
oneHalfDarkTable[6] = RGB( 86, 182, 194); // dark cyan
oneHalfDarkTable[7] = RGB(220, 223, 228); // gray
oneHalfDarkTable[8] = RGB( 90, 99, 116); // dark gray
oneHalfDarkTable[9] = RGB(224, 108, 117); // red
oneHalfDarkTable[10] = RGB(152, 195, 121); // green
oneHalfDarkTable[11] = RGB(229, 192, 123); // yellow
oneHalfDarkTable[12] = RGB( 97, 175, 239); // blue
oneHalfDarkTable[13] = RGB(198, 120, 221); // magenta
oneHalfDarkTable[14] = RGB( 86, 182, 194); // cyan
oneHalfDarkTable[15] = RGB(220, 223, 228); // white
Microsoft::Console::Utils::SetColorTableAlpha(oneHalfDarkSpan, 0xff);

return oneHalfDarkScheme;
}

ColorScheme _CreateOneHalfLightScheme()
{
// First 8 dark colors per: https://github.com/sonph/onehalf/blob/master/putty/onehalf-light.reg
// Last 8 colors per colortool scheme.
ColorScheme oneHalfLightScheme { L"One Half Light",
RGB(56, 58, 66),
RGB(250, 250, 250) };
auto& oneHalfLightTable = oneHalfLightScheme.GetTable();
auto oneHalfLightSpan = gsl::span<COLORREF>(&oneHalfLightTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
oneHalfLightTable[0] = RGB( 56, 58, 66); // black
oneHalfLightTable[1] = RGB(228, 86, 73); // dark red
oneHalfLightTable[2] = RGB( 80, 161, 79); // dark green
oneHalfLightTable[3] = RGB(193, 131, 1); // dark yellow
oneHalfLightTable[4] = RGB( 1, 132, 188); // dark blue
oneHalfLightTable[5] = RGB(166, 38, 164); // dark magenta
oneHalfLightTable[6] = RGB( 9, 151, 179); // dark cyan
oneHalfLightTable[7] = RGB(250, 250, 250); // gray
oneHalfLightTable[8] = RGB( 79, 82, 93); // dark gray
oneHalfLightTable[9] = RGB(223, 108, 117); // red
oneHalfLightTable[10] = RGB(152, 195, 121); // green
oneHalfLightTable[11] = RGB(228, 192, 122); // yellow
oneHalfLightTable[12] = RGB( 97, 175, 239); // blue
oneHalfLightTable[13] = RGB(197, 119, 221); // magenta
oneHalfLightTable[14] = RGB( 86, 181, 193); // cyan
oneHalfLightTable[15] = RGB(255, 255, 255); // white
Microsoft::Console::Utils::SetColorTableAlpha(oneHalfLightSpan, 0xff);

return oneHalfLightScheme;
}

ColorScheme _CreateSolarizedDarkScheme()
{
ColorScheme solarizedDarkScheme { L"Solarized Dark",
RGB(253, 246, 227),
RGB( 7, 54, 66) };
Expand Down Expand Up @@ -97,15 +157,17 @@ ColorScheme _CreateSolarizedLightScheme()

// Method Description:
// - Create the set of schemes to use as the default schemes. Currently creates
// three default color schemes - Campbell (the new cmd color scheme),
// Solarized Dark and Solarized Light.
// five default color schemes - Campbell (the new cmd color scheme),
// One Half Dark, One Half Light, Solarized Dark, and Solarized Light.
// Arguments:
// - <none>
// Return Value:
// - <none>
void CascadiaSettings::_CreateDefaultSchemes()
{
_globals.GetColorSchemes().emplace_back(_CreateCampbellScheme());
_globals.GetColorSchemes().emplace_back(_CreateOneHalfDarkScheme());
_globals.GetColorSchemes().emplace_back(_CreateOneHalfLightScheme());
_globals.GetColorSchemes().emplace_back(_CreateSolarizedDarkScheme());
_globals.GetColorSchemes().emplace_back(_CreateSolarizedLightScheme());
}
Expand Down Expand Up @@ -391,7 +453,7 @@ std::wstring CascadiaSettings::ExpandEnvironmentVariableString(std::wstring_view
do
{
result.resize(requiredSize);
requiredSize = ::ExpandEnvironmentStringsW(source.data(), result.data(), static_cast<DWORD>(result.size()));
requiredSize = ::ExpandEnvironmentStringsW(source.data(), result.data(), gsl::narrow<DWORD>(result.size()));
} while (requiredSize != result.size());

// Trim the terminating null character
Expand Down