-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
UI is broken in system high contrast mode #5360
Comments
Okay yea this is pretty bad. I would have thought that this might have to be fixed on the upstream TabView. However, looking at MUX#1663, that high-contrast tabview looks just fine. |
Wait now I'm reading that thread more, we might be able to get this by just updating to the latest MUX. This comment: microsoft/microsoft-ui-xaml#1663 (comment) made me think that they might have just solved this for us 😆 |
@zadjii-msft - I just stopped by the Terminal github project to send you guys an email to ask you to update to the latest MUX, so I can start contributing some PRs to smooth out Terminal's HC experience. I promise mimi8999 is not in cahoots with me, and this issue getting filed today is a total coincidence ;) XAML has a global "I understand high contrast" flag named ApplicationHighContrastAdjustment. For Terminal, it's currently in HC-ignorant mode, which means MUX is more aggressive about ignoring your colors and automatically backplating text. This is not wrong, but it will make it difficult to reach perfect beauty. Beyond updating MUX, the next best thing you can do is toggle that flag, then fix the issues that it was hiding (invisible dialog box buttons, menu text, wrong titlebar color, etc.) I'm happy to contribute wherever you can use help -- the whole reason I fixed MUX's TabView was so I could subsequently make my terminals not ugly. |
@jtippet Were you able to build Terminal with latest MUX release? I wasn't. |
I didn't attempt that. I've only prototyped the other half - cleaning up button labels and menu text. |
Triaging this for 1.x. If WinUI 2.4 lands before that, we may get it as part of a dependency updating pass. |
Since I was looking into bumping deps, I did try updating to the preview release (we are actually on a 2.2. preview so going to 2.4 preview seems acceptable) but ran into problems attempting to build. I can update the other stuff but while debug mode is fine, the release mode has an issue compiling conpty in preview mode of VS 2019 and a problem finding the generated .lib in stable. Not sure what exactly is at play but my fork is available to test with. Also, you need to statically assign paths for instead of using wildcards in the build process. VS2019 won't accept the wildcards (building Terminal becomes even worse without letting VS statically assign the build paths). |
Thanks for looking into this! I’m a bit concerned. We are using 2.3, for what it’s worth, and even though it says “prerelease” it’s definitely the full retail payload. There’s a depressing reason for that... but in short, the “prerelease” builds put their DLLs inside our package, and the retail ones do not, and we need that copy of their DLL. Which version of VS2019 are you seeing this with? The team has been building on 2019 since it came out, and hasn’t seen any trouble with the wildcards. |
1 similar comment
Thanks for looking into this! I’m a bit concerned. We are using 2.3, for what it’s worth, and even though it says “prerelease” it’s definitely the full retail payload. There’s a depressing reason for that... but in short, the “prerelease” builds put their DLLs inside our package, and the retail ones do not, and we need that copy of their DLL. Which version of VS2019 are you seeing this with? The team has been building on 2019 since it came out, and hasn’t seen any trouble with the wildcards. |
@DHowett-MSFT - may I request updating MUX again to 2.5.0-prerelease.200609001? That version contains a couple important fixes to unblock a fix for this issue:
With that version of MUX, Terminal is very close to being beautiful in all HC themes. Here's a peek at what it looks like with the newer MUX and a change to set Terminal to Compare that to the screenshot at the top of this thread, and I think it's clearly an improvement. The menu is rather less embarrassing too:
As a bonus, by updating to 2.5.0, you'll also get rounded tab feet, which is catnip for tab nerds: |
Also, I noticed that some icons in the taskbar change to monochrome and others don't. Why? |
There's definitely been progress -- comparing your original screenshot with your current one, you can see that the tab titles look better. That's fix 1663 in MUX, which already shipped in the store version of Terminal. The menu will be improved a bit once #6819 lands, and then there's really only one more line of code to add to Terminal to make everything look like the screenshot I shared.
The OS never automatically generates monochrome icons from a full-color icon. It would rarely look great, and in some cases, would make an unreadable mess. For the app launcher icons in the center of the taskbar, the shell relies on the app to provide a hand-crafted high contrast icon. But only UWP has the technology to designate an icon as being for high contrast -- classic win32 resources don't even have the concept. (Classic win32 can only tailor icons for display scale and color bitdepth, the latter of which is entirely obsolete, since nobody's rocking an EGA display anymore.) So a UWP app can display colorful icons when HC is disabled, while automatically switching to monochrome icons when HC is enabled. But a Win32 app has to choose one or the other, and can't adapt to the HC setting. That's why, in your screenshot, the File Explorer icon is not monochrome: File Explorer is a win32 app. Furthermore, an app will only change its icon if the app developer's art department actually troubled themselves to provide a high contrast version of the icon. That's why, in your screenshot, Terminal does not have a monochrome icon: the Terminal art department did not provide one. Although if you have more pixel talents than I, perhaps the Terminal team would accept a contribution of beautiful new HC icons? See here. Hopefully, as Project Reunion makes UWP technology more readily available, more developers will include high contrast icons with their apps. |
Ah. OK. I see that the tabs look good now, but the
Thanks for this long explanation. Hopefully Terminal will get a monochrome icon soon 😉 |
Yeah, I fixed the standard TabView [+] icon that ships with MUX. But Terminal doesn't use the standard icon. It builds its own from scratch, so it can have the dropdown menu. Don't worry though: I'm fixing Terminal's [+] button too: #6812
You can definitely write code to detect whether HC is enabled, and if so, query the background color. You don't even need undocumented APIs -- just query |
Update colors of our custom NewTab button to match MUX's TabView button MUX has a NewTab button, but Terminal uses a homemade lookalike. The version in Terminal doesn't use the same brush color resources as MUX's button, so it looks very slightly different. This PR updates Terminal's button to use the exact same colors that MUX uses. I literally copied these brush names out of MUX source code. ## References This is the color version of the layout fix #6766 This is a prerequisite for fixing #5360 ## Detailed Description of the Pull Request / Additional comments The real reason that this matters is that once you flip on `ApplicationHighContrastAdjustment::None`, the existing colors will not work at all. The existing brushes are themed to black foreground on a black background when High Contrast (HC) Black theme is enabled. The only thing that's saving you is `ApplicationHighContrastAdjustment::Auto` is automatically backplating the glyphs on the buttons, which (by design) hides the fact that the colors are poor. The backplates are those ugly squares inside the buttons on the HC themes. Before I can push a PR that disables automatic backplating (set `ApplicationHighContrastAdjustment` to `None`), we'll need to select better brushes that work in HC mode. MUX has already selected brushes that work great in all modes, so it just makes sense to use their brushes. The one very subtle difference here is that, for non-HC themes, the glyph's foreground has a bit more contrast when the button is in hovered/pressed states. Again this slight difference hardly matters now, but using the correct brushes will become critical when we try to remove the HC backplating. Closes #6812
See: https://github.com/microsoft/microsoft-ui-xaml/releases/tag/v2.5.0-prerelease.200609001 > ### Notable Changes: > > Resize tab view items only once the pointer has left the TabViewItem strip (microsoft/microsoft-ui-xaml#2569) > Align TabView visuals with Edge (microsoft/microsoft-ui-xaml#2201) > Fix background of MenuFlyout in white high contrast (microsoft/microsoft-ui-xaml#2446) > TabView: Make TabViewItem consume the TabViewItemHeaderForeground theme resource (microsoft/microsoft-ui-xaml#2348) > TabView: Add tooltips to its scrolling buttons. (microsoft/microsoft-ui-xaml#2369) * [x] Related to #5360 (@jtippet confirms that this alone does not close it.) * [x] I work here
This PR enables `ApplicationHighContrastAdjustment::None`. Doing this disables a set of mitigations in XAML designed to band-aid apps that were never explicitly designed for High Contrast (HC) modes. Terminal now has full control of and responsibility for its appearance in HC mode. This allows Terminal to look a lot better. On paper, we should be able to set `HighContrastAdjustment="None"` on the `<Application>` element. But that doesn't have any effect. I don't know if this is a bug in `<Toolkit:XamlApplication>` or somewhere else. So instead I set the property in codebehind, which is not as ideal, but does at least work. I'd love to a way to move this into App.xaml. The Find box had a couple stray styles to override the ToggleButton's foreground color. With backplating removed, these styles became actively harmful (white foreground on highlight color background), so I just removed them. The built-in style for ToggleButton is perfect as-is. Closes #5360
This commit adds image assets for High Contrast mode Tagging this issue so it contains a nice list of all the recent HC fixes: #5360 I made several changes to DHowett's script and added it to the repo: * Add support for generating high contrast icons * Add the ability to easily edit the "intermediate" (previously "zbase") files for manual hinting * Appease the spellchecker I created new SVGs for HC mode. There's one SVG for both Black and White modes -- I just invert the colors. Then I manually hinted the generated bitmaps for the production icons. I didn't bother hinting the Dev/Pre ones, so the text does get unreadable at small sizes. View the original images in #6915. Co-authored-by: Jeffrey Tippet <[email protected]> Co-authored-by: Dustin L. Howett <[email protected]> Closes #6822
Update colors of our custom NewTab button to match MUX's TabView button MUX has a NewTab button, but Terminal uses a homemade lookalike. The version in Terminal doesn't use the same brush color resources as MUX's button, so it looks very slightly different. This PR updates Terminal's button to use the exact same colors that MUX uses. I literally copied these brush names out of MUX source code. ## References This is the color version of the layout fix #6766 This is a prerequisite for fixing #5360 ## Detailed Description of the Pull Request / Additional comments The real reason that this matters is that once you flip on `ApplicationHighContrastAdjustment::None`, the existing colors will not work at all. The existing brushes are themed to black foreground on a black background when High Contrast (HC) Black theme is enabled. The only thing that's saving you is `ApplicationHighContrastAdjustment::Auto` is automatically backplating the glyphs on the buttons, which (by design) hides the fact that the colors are poor. The backplates are those ugly squares inside the buttons on the HC themes. Before I can push a PR that disables automatic backplating (set `ApplicationHighContrastAdjustment` to `None`), we'll need to select better brushes that work in HC mode. MUX has already selected brushes that work great in all modes, so it just makes sense to use their brushes. The one very subtle difference here is that, for non-HC themes, the glyph's foreground has a bit more contrast when the button is in hovered/pressed states. Again this slight difference hardly matters now, but using the correct brushes will become critical when we try to remove the HC backplating. Closes #6812 (cherry picked from commit 4faa104)
This commit adds image assets for High Contrast mode Tagging this issue so it contains a nice list of all the recent HC fixes: #5360 I made several changes to DHowett's script and added it to the repo: * Add support for generating high contrast icons * Add the ability to easily edit the "intermediate" (previously "zbase") files for manual hinting * Appease the spellchecker I created new SVGs for HC mode. There's one SVG for both Black and White modes -- I just invert the colors. Then I manually hinted the generated bitmaps for the production icons. I didn't bother hinting the Dev/Pre ones, so the text does get unreadable at small sizes. View the original images in #6915. Co-authored-by: Jeffrey Tippet <[email protected]> Co-authored-by: Dustin L. Howett <[email protected]> Closes #6822 (cherry picked from commit bd93cb5)
🎉This issue was addressed in #6915, which has now been successfully released as Handy links: |
1 similar comment
🎉This issue was addressed in #6915, which has now been successfully released as Handy links: |
🎉This issue was addressed in #6915, which has now been successfully released as Handy links: |
🎉This issue was addressed in #6833, which has now been successfully released as Handy links: |
Environment
Steps to reproduce
Turn on high contrast mode.
Expected behavior
UI elements should become easier to distinguish.
Actual behavior
Terminal UI elements are hard to identify. It took me some time to find the
+
button because it looks like the Windows logo or the start menu button and not like a+
. Dropdown button looks more like a checkbox than a dropdown button or arrow pointing down.The text was updated successfully, but these errors were encountered: