Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsModel/AppearanceConfig.cpp (C++)

Code before:
#include "pch.h"
#include "AppearanceConfig.h"
#include "AppearanceConfig.g.cpp"
#include "TerminalSettingsSerializationHelpers.h"
#include "JsonUtils.h"

using namespace winrt::Microsoft::Terminal::Control;
using namespace Microsoft::Terminal::Settings::Model;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;

static constexpr std::string_view ForegroundKey{ "foreground" };
static constexpr std::string_view BackgroundKey{ "background" };
static constexpr std::string_view SelectionBackgroundKey{ "selectionBackground" };
static constexpr std::string_view CursorColorKey{ "cursorColor" };
static constexpr std::string_view CursorShapeKey{ "cursorShape" };
static constexpr std::string_view CursorHeightKey{ "cursorHeight" };
static constexpr std::string_view BackgroundImageKey{ "backgroundImage" };
static constexpr std::string_view ColorSchemeKey{ "colorScheme" };
static constexpr std::string_view BackgroundImageOpacityKey{ "backgroundImageOpacity" };
static constexpr std::string_view BackgroundImageStretchModeKey{ "backgroundImageStretchMode" };
static constexpr std::string_view BackgroundImageAlignmentKey{ "backgroundImageAlignment" };
static constexpr std::string_view RetroTerminalEffectKey{ "experimental.retroTerminalEffect" };
static constexpr std::string_view PixelShaderPathKey{ "experimental.pixelShaderPath" };
static constexpr std::string_view IntenseTextStyleKey{ "intenseTextStyle" };
static constexpr std::string_view PerceptualColorNudgingKey{ "perceptualColorNudging" };

winrt::Microsoft::Terminal::Settings::Model::implementation::AppearanceConfig::AppearanceConfig(const winrt::weak_ref<Profile> sourceProfile) :
    _sourceProfile(sourceProfile)
{
}

winrt::com_ptr<AppearanceConfig> AppearanceConfig::CopyAppearance(const winrt::com_ptr<AppearanceConfig> source, const winrt::weak_ref<Profile> sourceProfile)
{
    auto appearance{ winrt::make_self<AppearanceConfig>(sourceProfile) };
    auto const sourceAppearance = source.try_as<AppearanceConfig>();
    appearance->_BackgroundImagePath = sourceAppearance->_BackgroundImagePath;
    appearance->_BackgroundImageOpacity = sourceAppearance->_BackgroundImageOpacity;
    appearance->_BackgroundImageStretchMode = sourceAppearance->_BackgroundImageStretchMode;
    appearance->_ColorSchemeName = sourceAppearance->_ColorSchemeName;
    appearance->_Foreground = sourceAppearance->_Foreground;
    appearance->_Background = sourceAppearance->_Background;
    appearance->_SelectionBackground = sourceAppearance->_SelectionBackground;
    appearance->_CursorColor = sourceAppearance->_CursorColor;
    appearance->_CursorShape = sourceAppearance->_CursorShape;
    appearance->_CursorHeight = sourceAppearance->_CursorHeight;
    appearance->_BackgroundImageAlignment = sourceAppearance->_BackgroundImageAlignment;
    appearance->_RetroTerminalEffect = sourceAppearance->_RetroTerminalEffect;
    appearance->_PixelShaderPath = sourceAppearance->_PixelShaderPath;
    appearance->_IntenseTextStyle = sourceAppearance->_IntenseTextStyle;
    appearance->_PerceptualColorNudging = sourceAppearance->_PerceptualColorNudging;

Review comment (suggestion):
Is there a better name we can use here? What does ConEmu use? Particularly don't like the "Nudging" bit.

CC @cinnamon-msft to poll her opinions

Code after:
#include "pch.h"
#include "AppearanceConfig.h"
#include "AppearanceConfig.g.cpp"
#include "TerminalSettingsSerializationHelpers.h"
#include "JsonUtils.h"

using namespace winrt::Microsoft::Terminal::Control;
using namespace Microsoft::Terminal::Settings::Model;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;

static constexpr std::string_view ForegroundKey{ "foreground" };
static constexpr std::string_view BackgroundKey{ "background" };
static constexpr std::string_view SelectionBackgroundKey{ "selectionBackground" };
static constexpr std::string_view CursorColorKey{ "cursorColor" };
static constexpr std::string_view CursorShapeKey{ "cursorShape" };
static constexpr std::string_view CursorHeightKey{ "cursorHeight" };
static constexpr std::string_view BackgroundImageKey{ "backgroundImage" };
static constexpr std::string_view ColorSchemeKey{ "colorScheme" };
static constexpr std::string_view BackgroundImageOpacityKey{ "backgroundImageOpacity" };
static constexpr std::string_view BackgroundImageStretchModeKey{ "backgroundImageStretchMode" };
static constexpr std::string_view BackgroundImageAlignmentKey{ "backgroundImageAlignment" };
static constexpr std::string_view RetroTerminalEffectKey{ "experimental.retroTerminalEffect" };
static constexpr std::string_view PixelShaderPathKey{ "experimental.pixelShaderPath" };
static constexpr std::string_view IntenseTextStyleKey{ "intenseTextStyle" };
static constexpr std::string_view AdjustIndistinguishableColorsKey{ "adjustIndistinguishableColors" };
static constexpr std::string_view LegacyAcrylicTransparencyKey{ "acrylicOpacity" };
static constexpr std::string_view OpacityKey{ "opacity" };

AppearanceConfig::AppearanceConfig(winrt::weak_ref<Profile> sourceProfile) :
    _sourceProfile(std::move(sourceProfile))
{
}

winrt::com_ptr<AppearanceConfig> AppearanceConfig::CopyAppearance(const AppearanceConfig* source, winrt::weak_ref<Profile> sourceProfile)
{
    auto appearance{ winrt::make_self<AppearanceConfig>(std::move(sourceProfile)) };
    appearance->_BackgroundImagePath = source->_BackgroundImagePath;
    appearance->_BackgroundImageOpacity = source->_BackgroundImageOpacity;
    appearance->_BackgroundImageStretchMode = source->_BackgroundImageStretchMode;
    appearance->_ColorSchemeName = source->_ColorSchemeName;
    appearance->_Foreground = source->_Foreground;
    appearance->_Background = source->_Background;
    appearance->_SelectionBackground = source->_SelectionBackground;
    appearance->_CursorColor = source->_CursorColor;
    appearance->_CursorShape = source->_CursorShape;
    appearance->_CursorHeight = source->_CursorHeight;
    appearance->_BackgroundImageAlignment = source->_BackgroundImageAlignment;
    appearance->_RetroTerminalEffect = source->_RetroTerminalEffect;
    appearance->_PixelShaderPath = source->_PixelShaderPath;
    appearance->_IntenseTextStyle = source->_IntenseTextStyle;