Skip to content

Commit

Permalink
Disable being able to set the automatic adjustment of indistinguishab…
Browse files Browse the repository at this point in the history
…le text (#12160)

## Summary of the Pull Request
Disables the automatic adjustment of indistinguishable text (added in #11095) because of the concerns brought up in #11917. Also, the setting is hidden in the SUI for as long as this feature remains disabled.

## PR Checklist
* [ ] Closes #xxx
* [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
  • Loading branch information
PankajBhojwani committed Jan 18, 2022
1 parent 084bf89 commit f605adc
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
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
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>
3 changes: 2 additions & 1 deletion src/renderer/base/RenderSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ std::pair<COLORREF, COLORREF> RenderSettings::GetAttributeColors(const TextAttri

// We want to nudge the foreground color to make it more perceivable only for the
// default color pairs within the color table
if (GetRenderMode(Mode::DistinguishableColors) &&
if (Feature_AdjustIndistinguishableText::IsEnabled() &&
GetRenderMode(Mode::DistinguishableColors) &&
!dimFg &&
(fgTextColor.IsDefault() || fgTextColor.IsLegacy()) &&
(bgTextColor.IsDefault() || bgTextColor.IsLegacy()))
Expand Down

0 comments on commit f605adc

Please sign in to comment.