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

Change AdjustIndistinguishableColors to an enum setting instead of a boolean setting #13512

Merged
13 commits merged into from
Jul 22, 2022

Conversation

PankajBhojwani
Copy link
Contributor

@PankajBhojwani PankajBhojwani commented Jul 14, 2022

Summary of the Pull Request

AdjustIndistinguishableColors can now be set to:

  • Never: Never adjust the colors
  • Indexed: Only adjust colors that are part of the color scheme
  • Always: Always adjust the colors

References

#13343

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

For legacy purposes, true and false map to Indexed and Never respectively

Validation Steps Performed

Setting still works

@PankajBhojwani PankajBhojwani marked this pull request as ready for review July 14, 2022 20:59
@@ -199,7 +199,7 @@ 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 (Feature_AdjustIndistinguishableText::IsEnabled() &&
GetRenderMode(Mode::DistinguishableColors) &&
GetRenderMode(Mode::IndexedDistinguishableColors) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be...

        (GetRenderMode(Mode::IndexedDistinguishableColors) || GetRenderMode(Mode::IndexedDistinguishableColors)) &&

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be...

        (GetRenderMode(Mode::IndexedDistinguishableColors) || GetRenderMode(Mode::IndexedDistinguishableColors)) &&

Shouldn't that be

        (GetRenderMode(Mode::IndexedDistinguishableColors) || GetRenderMode(Mode::AlwaysDistinguishableColors)) &&

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code is for: "Indexed was the mode chosen, so use our precalculated 'adjusted' color table to determine the foreground color", but we don't want to enter this block of code at all if the mode is Always because in that case we just call the color adjustment function on whatever the final foreground is (see line 255)

Comment on lines +175 to +176
_renderSettings.SetRenderMode(RenderSettings::Mode::IndexedDistinguishableColors, false);
_renderSettings.SetRenderMode(RenderSettings::Mode::AlwaysDistinguishableColors, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_renderSettings.SetRenderMode(RenderSettings::Mode::IndexedDistinguishableColors, false);
_renderSettings.SetRenderMode(RenderSettings::Mode::AlwaysDistinguishableColors, true);
_renderSettings.SetRenderMode(RenderSettings::Mode::IndexedDistinguishableColors, true);
_renderSettings.SetRenderMode(RenderSettings::Mode::AlwaysDistinguishableColors, true);

Should we just set both to true just to be safe? That way if someone in the future adds a feature to indexed, but forgets to check for "always", nothing will break?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I'm curious about this too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I set this to false for now is that we don't want to bother with creating the pre-calculated color table at all if the mode is Always, since we don't even access the table and instead we calculate the adjusted foreground just before rendering (see line 255 in RenderSettings.cpp)

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 15, 2022
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 15, 2022
@carlos-zamora
Copy link
Member

And don't forget to update the schema/docs plz

doc/cascadia/profiles.schema.json Outdated Show resolved Hide resolved
doc/cascadia/profiles.schema.json Outdated Show resolved Hide resolved
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 22, 2022
@ghost
Copy link

ghost commented Jul 22, 2022

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit d3ae00e into main Jul 22, 2022
@ghost ghost deleted the dev/pabhoj/delta_e_further branch July 22, 2022 11:41
@ghost
Copy link

ghost commented Sep 13, 2022

🎉Windows Terminal Preview v1.16.252 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants