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
[core] feat: support windows high contrast mode #5524
Merged
Merged
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
690cbea
Add border colors for high contrast mode only
styu df13070
fix selects and switches
styu d9aa285
forgot to save
styu 7822896
typo
styu ff6eecd
add a couple more
styu 67bf451
Merge remote-tracking branch 'origin/develop' into syu/high-contrast-…
adidahiya ed3b9f3
Disable overly prescriptive stylelint rule
adidahiya cd254c4
fix value type of high-contrast-control-border-color
adidahiya 378bafc
Use system colors
styu 90ce6a6
fix compile
styu 9a15a8d
More fixes
styu f0946d9
fix popovers and more controls
styu 9c643c1
fix elevations, tables, inputs
styu 18af9c0
fix popover2, more controls
styu 29834b7
refactor into variables, lint
styu a932a65
undo dumb find and replace
styu 49e3c44
fix disabled styles
styu 5b5a8ff
lint
styu bee6b85
fix table styles again
styu 6e73182
address comments, fix dialog and drawer
styu dbf64ca
fix compile
styu e831c5e
fix compile?
styu a969534
alph
styu File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -31,6 +31,12 @@ | |
box-shadow: input-transition-shadow($input-shadow-color-focus, true), $input-box-shadow-focus; | ||
} | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
&::before { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
border: 1px solid $pt-high-contrast-mode-border-color; | ||
} | ||
} | ||
|
||
@each $intent, $color in $pt-intent-colors { | ||
&.#{$ns}-intent-#{$intent} { | ||
.#{$ns}-editable-text-content, | ||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -34,10 +34,21 @@ $control-indicator-spacing: $pt-grid-size !default; | |
background-color: $control-checked-background-color; | ||
box-shadow: $control-checked-box-shadow; | ||
color: $white; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
background-color: $pt-high-contrast-mode-active-background-color; | ||
// Windows High Contrast dark theme | ||
border: 1px solid $pt-high-contrast-mode-active-background-color; | ||
} | ||
} | ||
|
||
&:hover input#{$selector} ~ .#{$ns}-control-indicator { | ||
background-color: $control-checked-background-color-hover; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
background-color: $pt-high-contrast-mode-active-background-color; | ||
styu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
input:not(:disabled):active#{$selector} ~ .#{$ns}-control-indicator { | ||
|
@@ -53,6 +64,11 @@ $control-indicator-spacing: $pt-grid-size !default; | |
.#{$ns}-dark & { | ||
input#{$selector} ~ .#{$ns}-control-indicator { | ||
box-shadow: $dark-control-checked-box-shadow; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
border: 1px solid $pt-high-contrast-mode-border-color; | ||
} | ||
} | ||
|
||
&:hover input#{$selector} ~ .#{$ns}-control-indicator { | ||
|
@@ -145,6 +161,18 @@ $control-indicator-spacing: $pt-grid-size !default; | |
height: 1em; | ||
width: 1em; | ||
} | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
border: 1px solid $pt-high-contrast-mode-border-color; | ||
|
||
&::before { | ||
// Because we're using a border in high contrast mode, we need to adjust the margins | ||
// to compensate for the space the border takes up | ||
margin-left: -1px; | ||
margin-top: -1px; | ||
} | ||
} | ||
} | ||
|
||
&:hover .#{$ns}-control-indicator { | ||
|
@@ -215,6 +243,10 @@ $control-indicator-spacing: $pt-grid-size !default; | |
// embed SVG icon image as backgroud-image above gradient. | ||
// the SVG image content is inlined into the CSS, so use this sparingly. | ||
background-image: svg-icon("16px/#{$icon}.svg", (path: (fill: $white))); | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
background-image: svg-icon("16px/#{$icon}.svg", (path: (fill: $black))); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -259,6 +291,16 @@ $control-indicator-spacing: $pt-grid-size !default; | |
|
||
input:checked ~ .#{$ns}-control-indicator::before { | ||
background-image: radial-gradient($white, $white 28%, transparent 32%); | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
background: $pt-high-contrast-mode-active-background-color; | ||
// Subtract border on either end, and then an extra 2px for space between the border | ||
height: $control-indicator-size - 4px; | ||
margin-left: 1px; | ||
margin-top: 1px; | ||
width: $control-indicator-size - 4px; | ||
} | ||
} | ||
|
||
input:checked:disabled ~ .#{$ns}-control-indicator::before { | ||
|
@@ -339,6 +381,7 @@ $control-indicator-spacing: $pt-grid-size !default; | |
$selector, | ||
$text-color, | ||
$background-color, | ||
$high-contrast-background-color, | ||
$hover-color, | ||
$active-color, | ||
$disabled-text-color, | ||
|
@@ -348,10 +391,21 @@ $control-indicator-spacing: $pt-grid-size !default; | |
input#{$selector} ~ .#{$ns}-control-indicator { | ||
background: $background-color; | ||
color: $text-color; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
background: $high-contrast-background-color; | ||
border: 1px solid $pt-high-contrast-mode-border-color; | ||
} | ||
} | ||
|
||
&:hover input#{$selector} ~ .#{$ns}-control-indicator { | ||
background: $hover-color; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
background: $high-contrast-background-color; | ||
} | ||
} | ||
|
||
input#{$selector}:not(:disabled):active ~ .#{$ns}-control-indicator { | ||
|
@@ -373,6 +427,7 @@ $control-indicator-spacing: $pt-grid-size !default; | |
"", | ||
$switch-text-color, | ||
$switch-background-color, | ||
$switch-background-color, | ||
$switch-background-color-hover, | ||
$switch-background-color-active, | ||
$switch-text-color-disabled, | ||
|
@@ -383,6 +438,7 @@ $control-indicator-spacing: $pt-grid-size !default; | |
":checked", | ||
$switch-checked-text-color, | ||
$switch-checked-background-color, | ||
$pt-high-contrast-mode-active-background-color, // Use the system color for selected items | ||
$switch-checked-background-color-hover, | ||
$switch-checked-background-color-active, | ||
$switch-checked-text-color-disabled, | ||
|
@@ -412,6 +468,13 @@ $control-indicator-spacing: $pt-grid-size !default; | |
position: absolute; | ||
transition: left $pt-transition-duration $pt-transition-ease; | ||
width: $switch-indicator-size; | ||
|
||
@media (forced-colors: active) and (prefers-color-scheme: dark) { | ||
// Windows High Contrast dark theme | ||
border: 1px solid $pt-high-contrast-mode-border-color; | ||
// Because we're using a border for the outline, we need to decrease the top margin | ||
margin-top: 1px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be |
||
} | ||
} | ||
} | ||
|
||
|
@@ -429,6 +492,7 @@ $control-indicator-spacing: $pt-grid-size !default; | |
"", | ||
$dark-switch-text-color, | ||
$dark-switch-background-color, | ||
$dark-switch-background-color, | ||
$dark-switch-background-color-hover, | ||
$dark-switch-background-color-active, | ||
$dark-switch-text-color-disabled, | ||
|
@@ -439,6 +503,7 @@ $control-indicator-spacing: $pt-grid-size !default; | |
":checked", | ||
$dark-switch-checked-text-color, | ||
$dark-switch-checked-background-color, | ||
$pt-high-contrast-mode-active-background-color, | ||
$dark-switch-checked-background-color-hover, | ||
$dark-switch-checked-background-color-active, | ||
$dark-switch-checked-text-color-disabled, | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be helpful to link to documentation here, like https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/system_color_keywords