dd5dbb2a40
- Implements the Delta E algorithm - Uses the Delta E algorithm to precalculate adjusted foreground values based on possible foreground/background color pairs in the color table - Adds a setting to use the adjusted foreground values when applicable ## PR Checklist * [x] Closes #2638 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] I work here ## Validation Steps Performed Before: <img width="759" alt="color before" src="https://user-images.githubusercontent.com/26824113/131576768-b3b9eebd-5933-45de-8da8-88a985070312.png"> After (note dark blue): <img width="760" alt="color after" src="https://user-images.githubusercontent.com/26824113/133158807-4e63198f-8a49-4d03-914e-55a5ad57d725.png">
89 lines
3.8 KiB
C++
89 lines
3.8 KiB
C++
#pragma once
|
|
|
|
#include "pch.h"
|
|
#include <WexTestClass.h>
|
|
|
|
#include "DefaultSettings.h"
|
|
|
|
#include <winrt/Microsoft.Terminal.Core.h>
|
|
#include "../inc/cppwinrt_utils.h"
|
|
|
|
using namespace winrt::Microsoft::Terminal::Core;
|
|
|
|
namespace TerminalCoreUnitTests
|
|
{
|
|
class MockTermSettings : public winrt::implements<MockTermSettings, ICoreSettings, ICoreAppearance>
|
|
{
|
|
public:
|
|
MockTermSettings(int32_t historySize, int32_t initialRows, int32_t initialCols) :
|
|
_historySize(historySize),
|
|
_initialRows(initialRows),
|
|
_initialCols(initialCols)
|
|
{
|
|
}
|
|
|
|
// property getters - all implemented
|
|
int32_t HistorySize() { return _historySize; }
|
|
int32_t InitialRows() { return _initialRows; }
|
|
int32_t InitialCols() { return _initialCols; }
|
|
til::color DefaultForeground() { return COLOR_WHITE; }
|
|
til::color DefaultBackground() { return COLOR_BLACK; }
|
|
bool SnapOnInput() { return false; }
|
|
bool AltGrAliasing() { return true; }
|
|
til::color CursorColor() { return COLOR_WHITE; }
|
|
CursorStyle CursorShape() const noexcept { return CursorStyle::Vintage; }
|
|
uint32_t CursorHeight() { return 42UL; }
|
|
winrt::hstring WordDelimiters() { return winrt::hstring(DEFAULT_WORD_DELIMITERS); }
|
|
bool CopyOnSelect() { return _copyOnSelect; }
|
|
bool FocusFollowMouse() { return _focusFollowMouse; }
|
|
winrt::hstring StartingTitle() { return _startingTitle; }
|
|
bool SuppressApplicationTitle() { return _suppressApplicationTitle; }
|
|
til::color SelectionBackground() { return COLOR_WHITE; }
|
|
bool ForceVTInput() { return false; }
|
|
ICoreAppearance UnfocusedAppearance() { return {}; };
|
|
winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color> TabColor() { return nullptr; }
|
|
winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color> StartingTabColor() { return nullptr; }
|
|
bool TrimBlockSelection() { return false; }
|
|
bool DetectURLs() { return true; }
|
|
|
|
// other implemented methods
|
|
til::color GetColorTableEntry(int32_t) const { return 123; }
|
|
|
|
// property setters - all unimplemented
|
|
void HistorySize(int32_t) {}
|
|
void InitialRows(int32_t) {}
|
|
void InitialCols(int32_t) {}
|
|
void DefaultForeground(til::color) {}
|
|
void DefaultBackground(til::color) {}
|
|
void SnapOnInput(bool) {}
|
|
void AltGrAliasing(bool) {}
|
|
void CursorColor(til::color) {}
|
|
void CursorShape(CursorStyle const&) noexcept {}
|
|
void CursorHeight(uint32_t) {}
|
|
void WordDelimiters(winrt::hstring) {}
|
|
void CopyOnSelect(bool copyOnSelect) { _copyOnSelect = copyOnSelect; }
|
|
void FocusFollowMouse(bool focusFollowMouse) { _focusFollowMouse = focusFollowMouse; }
|
|
void StartingTitle(winrt::hstring const& value) { _startingTitle = value; }
|
|
void SuppressApplicationTitle(bool suppressApplicationTitle) { _suppressApplicationTitle = suppressApplicationTitle; }
|
|
void SelectionBackground(til::color) {}
|
|
void ForceVTInput(bool) {}
|
|
void UnfocusedAppearance(ICoreAppearance) {}
|
|
void TabColor(const IInspectable&) {}
|
|
void StartingTabColor(const IInspectable&) {}
|
|
void TrimBlockSelection(bool) {}
|
|
void DetectURLs(bool) {}
|
|
|
|
WINRT_PROPERTY(bool, IntenseIsBright, true);
|
|
WINRT_PROPERTY(bool, AdjustIndistinguishableColors, true);
|
|
|
|
private:
|
|
int32_t _historySize;
|
|
int32_t _initialRows;
|
|
int32_t _initialCols;
|
|
bool _copyOnSelect{ false };
|
|
bool _focusFollowMouse{ false };
|
|
bool _suppressApplicationTitle{ false };
|
|
winrt::hstring _startingTitle;
|
|
};
|
|
}
|