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

Disable being able to set the automatic adjustment of indistinguishable text #12160

Merged
5 commits merged into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 3 additions & 4 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ Terminal::Terminal() :
_taskbarState{ 0 },
_taskbarProgress{ 0 },
_trimBlockSelection{ false },
_intenseIsBright{ true },
_adjustIndistinguishableColors{ true }
_intenseIsBright{ true }
{
auto dispatch = std::make_unique<TerminalDispatch>(*this);
auto engine = std::make_unique<OutputStateMachineEngine>(std::move(dispatch));
Expand Down Expand Up @@ -198,7 +197,7 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
{
_colorTable.at(i) = til::color{ appearance.GetColorTableEntry(i) };
}
if (_adjustIndistinguishableColors)
if (_adjustIndistinguishableColors && Feature_AdjustIndistinguishableText::IsEnabled())
{
_MakeAdjustedColorArray();
}
Expand Down Expand Up @@ -1356,7 +1355,7 @@ void Terminal::ApplyScheme(const Scheme& colorScheme)

_colorTable.at(TextColor::CURSOR_COLOR) = til::color{ colorScheme.CursorColor };

if (_adjustIndistinguishableColors)
if (_adjustIndistinguishableColors && Feature_AdjustIndistinguishableText::IsEnabled())
{
_MakeAdjustedColorArray();
}
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalCore/terminalrenderdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ std::pair<COLORREF, COLORREF> Terminal::GetAttributeColors(const TextAttribute&

// We want to nudge the foreground color to make it more perceivable only for the
// default color pairs within the color table
if (_adjustIndistinguishableColors &&
if (_adjustIndistinguishableColors && Feature_AdjustIndistinguishableText::IsEnabled() &&
!(attr.IsFaint() || (attr.IsBlinking() && _blinkingState.IsBlinkingFaint())) &&
(fgTextColor.IsDefault() || fgTextColor.IsLegacy()) &&
(bgTextColor.IsDefault() || bgTextColor.IsLegacy()))
Expand Down
5 changes: 5 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Appearances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
INITIALIZE_BINDABLE_ENUM_SETTING(IntenseTextStyle, IntenseTextStyle, winrt::Microsoft::Terminal::Settings::Model::IntenseStyle, L"Appearance_IntenseTextStyle", L"Content");
}

bool Appearances::ShowIndistinguishableColorsItem() const noexcept
{
return Feature_AdjustIndistinguishableText::IsEnabled();
}

// Method Description:
// - Searches through our list of monospace fonts to determine if the settings model's current font face is a monospace font
bool Appearances::UsingMonospaceFont() const noexcept
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Appearances.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
public:
Appearances();

bool ShowIndistinguishableColorsItem() const noexcept;

// font face
Windows::Foundation::IInspectable CurrentFontFace() const;

Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Appearances.idl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace Microsoft.Terminal.Settings.Editor
ProfileViewModel SourceProfile;
static Windows.UI.Xaml.DependencyProperty AppearanceProperty { get; };

Boolean ShowIndistinguishableColorsItem { get; };

Boolean UsingMonospaceFont { get; };
Boolean ShowAllFonts;

Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalSettingsEditor/Appearances.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@
<local:SettingContainer x:Uid="Profile_AdjustIndistinguishableColors"
ClearSettingValue="{x:Bind Appearance.ClearAdjustIndistinguishableColors}"
HasSettingValue="{x:Bind Appearance.HasAdjustIndistinguishableColors, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.AdjustIndistinguishableColorsOverrideSource, Mode=OneWay}">
SettingOverrideSource="{x:Bind Appearance.AdjustIndistinguishableColorsOverrideSource, Mode=OneWay}"
Visibility="{x:Bind ShowIndistinguishableColorsItem}">
<ToggleSwitch IsOn="{x:Bind Appearance.AdjustIndistinguishableColors, Mode=TwoWay}" />
</local:SettingContainer>
</StackPanel>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsModel/MTSMSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ Author(s):
X(hstring, ColorSchemeName, "colorScheme", L"Campbell") \
X(hstring, BackgroundImagePath, "backgroundImage") \
X(Model::IntenseStyle, IntenseTextStyle, "intenseTextStyle", Model::IntenseStyle::Bright) \
X(bool, AdjustIndistinguishableColors, "adjustIndistinguishableColors", true)
X(bool, AdjustIndistinguishableColors, "adjustIndistinguishableColors", false)
6 changes: 6 additions & 0 deletions src/features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@
<brandingToken>WindowsInbox</brandingToken>
</alwaysDisabledBrandingTokens>
</feature>

<feature>
<name>Feature_AdjustIndistinguishableText</name>
<description>If enabled, the foreground color will, when necessary, be automatically adjusted to make it more visible.</description>
<stage>AlwaysDisabled</stage>
</feature>
</featureStaging>