terminal/src/cascadia/TerminalApp/ColorScheme.h
Dustin L. Howett (MSFT) 6394e5d70b
Remove the JSON reserializers (except for AKB) (#5918)
The AKB serializer is used in the tracelogging pipeline.

Chatted with @zadjii-msft about ganking the deserializers. The form
they'll take in the future is probably very different from this.

We'll need to have some better tracking of the _source_ or _pass_ a
setting was read during so that we can accurately construct an internal
settings attribution model. Diffing was very extremely cool, but we
didn't end up needing it.

This apparently drops our binary size by a whopping _zero bytes_ because
the optimizer was smarter than us and actually totally deleted it.
2020-05-15 14:51:57 -07:00

67 lines
1.9 KiB
C++

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- ColorScheme.hpp
Abstract:
- A color scheme is a single set of colors to use as the terminal colors. These
schemes are named, and can be used to quickly change all the colors of the
terminal to another scheme.
Author(s):
- Mike Griese - March 2019
--*/
#pragma once
#include <winrt/Microsoft.Terminal.Settings.h>
#include <winrt/Microsoft.Terminal.TerminalControl.h>
#include "../../inc/conattrs.hpp"
// fwdecl unittest classes
namespace TerminalAppLocalTests
{
class SettingsTests;
class ColorSchemeTests;
};
namespace TerminalApp
{
class ColorScheme;
};
class TerminalApp::ColorScheme
{
public:
ColorScheme();
ColorScheme(std::wstring name, COLORREF defaultFg, COLORREF defaultBg, COLORREF cursorColor);
~ColorScheme();
void ApplyScheme(winrt::Microsoft::Terminal::Settings::TerminalSettings terminalSettings) const;
static ColorScheme FromJson(const Json::Value& json);
bool ShouldBeLayered(const Json::Value& json) const;
void LayerJson(const Json::Value& json);
std::wstring_view GetName() const noexcept;
std::array<COLORREF, COLOR_TABLE_SIZE>& GetTable() noexcept;
COLORREF GetForeground() const noexcept;
COLORREF GetBackground() const noexcept;
COLORREF GetSelectionBackground() const noexcept;
COLORREF GetCursorColor() const noexcept;
static std::optional<std::wstring> GetNameFromJson(const Json::Value& json);
private:
std::wstring _schemeName;
std::array<COLORREF, COLOR_TABLE_SIZE> _table;
COLORREF _defaultForeground;
COLORREF _defaultBackground;
COLORREF _selectionBackground;
COLORREF _cursorColor;
friend class TerminalAppLocalTests::SettingsTests;
friend class TerminalAppLocalTests::ColorSchemeTests;
};