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

Flash the pane dark when BEL is emitted in a light terminal #13707

Merged
4 commits merged into from
Aug 11, 2022

Conversation

Fyrebright
Copy link
Contributor

@Fyrebright Fyrebright commented Aug 9, 2022

Adds a variable _isBackgroundLight that is updated when the background
color is changed. When it is true, the BEL indicator flash will darken
the screen instead of brightening.

_isColorLight(bg) returns true if the average of r, g, and b
is >127

I was unsure of an appropriate way to change the color of the
CompositionLight based on the background, so I changed it to always be
gray and adjusted the intensity values of the original animation to have
roughly the same visual effect as the white.

Validation Steps Performed

  • Tested the two flashes on the default color schemes and some custom
    background colors to see if they look consistent
  • Used tracepoints and visual to check that the right animation is used
    (including multiple tabs, split windows with different themes, and
    changing settings while window is open)

References #9270
Closes #13450

@ghost ghost added Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Aug 9, 2022
@Fyrebright Fyrebright marked this pull request as ready for review August 9, 2022 15:14
@github-actions

This comment has been minimized.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Thanks for whipping this up!

{
_bellLightAnimation = Window::Current().Compositor().CreateScalarKeyFrameAnimation();
// Add key frames and a duration to our bell light animation
_bellLightAnimation.InsertKeyFrame(0.0, 2.0);
_bellLightAnimation.InsertKeyFrame(1.0, 1.0);
_bellLightAnimation.InsertKeyFrame(0.0, 4.0);
Copy link
Member

Choose a reason for hiding this comment

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

oh, right, okay, I get it. I was all confused why the current animation was moved to the light-colored BGs.

Before, we had a White light, that we animated from 2->1 Intensity. Now we've got a Gray light, so for dark BGs, we need a different animation. It's coincidental that the light BG version of the animation just so happens to use 1->2 Intensity (but now that I've typed it, I'm better realizing that's not even the same values as before 😅)

@zadjii-msft
Copy link
Member

New Bells:

gh-13707-new-dark
gh-13707-new-light

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

This is amazing, thank you.

@DHowett DHowett changed the title Flash the pane dark when BEL is emitted and pane's appearance has a light background Flash the pane dark when BEL is emitted in a light terminal Aug 11, 2022
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 11, 2022
@ghost
Copy link

ghost commented Aug 11, 2022

Hello @DHowett!

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 ea04823 into microsoft:main Aug 11, 2022
@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
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flash the pane dark when BEL is emitted and pane's appearance has a light background
4 participants