-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Style ToolTip to make it dark enough in Dark mode #12420
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
Open
willibrandon
wants to merge
18
commits into
dotnet:main
Choose a base branch
from
willibrandon:fix-tooltip-dark-mode-colors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8b345fe
Disabling ToolTip visual styles to make it dark enough in Dark mode
willibrandon f5a017b
Feedback from code review
willibrandon e980d69
Fix spacing
willibrandon 6e1fd22
More fluent assertions
willibrandon ae2c320
ApplicationColorModeScope feedback from code review
willibrandon 3278d8d
Set theme to DarkMode_Explorer and round the corners with a small radius
willibrandon f4d6102
Assert the rounded corner preference
willibrandon a4ead96
Corner preference is supported starting with Windows 11 Build 22000
willibrandon c34aa2d
Use default corner preference for balloon windows
willibrandon 10e0bbb
Initialize colors from dark mode explorer tooltip theme subclass
willibrandon d4c985b
Set colors in a similar way as ListView and TreeView
willibrandon 674c1c7
Utilize theme for visual styles and remove the get colors test
willibrandon 26e4f93
Remove constant
willibrandon 05412b8
Darken the ListView ToolTip in Dark mode
willibrandon 1e35f2b
Darken the TreeView ToolTip in Dark mode
willibrandon 7810b62
Darken the TabControl ToolTip in Dark mode
willibrandon 3bcc1d2
Revert unnecessary change
willibrandon 625896f
Move to OnHandleCreated
willibrandon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/System.Windows.Forms/tests/TestUtilities/ApplicationColorModeScope.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Windows.Forms; | ||
|
|
||
| namespace System; | ||
|
|
||
| #pragma warning disable WFO5001 | ||
| /// <summary> | ||
| /// Scope for setting the default color mode (dark mode) for the application. Use in a <see langword="using"/> statement. | ||
| /// </summary> | ||
| public readonly ref struct ApplicationColorModeScope | ||
| { | ||
| private readonly SystemColorMode _originalColorMode; | ||
|
|
||
| public ApplicationColorModeScope(SystemColorMode colorMode) | ||
| { | ||
| // Prevent multiple ApplicationColorModeScopes from running simultaneously. | ||
| // Using Monitor to allow recursion on the same thread. | ||
| Monitor.Enter(typeof(ApplicationColorModeScope)); | ||
| _originalColorMode = Application.ColorMode; | ||
|
|
||
| if (_originalColorMode != colorMode) | ||
| { | ||
| Application.SetColorMode(colorMode); | ||
| } | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| try | ||
|
willibrandon marked this conversation as resolved.
Outdated
|
||
| { | ||
| if (Application.ColorMode != _originalColorMode) | ||
| { | ||
| Application.SetColorMode(_originalColorMode); | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| Monitor.Exit(typeof(ApplicationColorModeScope)); | ||
| } | ||
| } | ||
| } | ||
| #pragma warning restore WFO5001 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.