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

Implement high contrast mode #13203

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions web/pdf_viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
@import url(annotation_layer_builder.css);
@import url(xfa_layer_builder.css);

:root {
--pdfViewer-padding-bottom: none;
--page-margin: 1px auto -8px;
--page-border: 9px solid transparent;
--spreadHorizontalWrapped-margin-LR: -3.5px;
}

@media screen and (forced-colors: active) {
:root {
--pdfViewer-padding-bottom: 9px;
--page-margin: 9px auto 0;
--page-border: none;
--spreadHorizontalWrapped-margin-LR: 4.5px;
}
}

.pdfViewer {
padding-bottom: var(--pdfViewer-padding-bottom);
}

.pdfViewer .canvasWrapper {
overflow: hidden;
}
Expand All @@ -24,10 +44,10 @@
direction: ltr;
width: 816px;
height: 1056px;
margin: 1px auto -8px;
margin: var(--page-margin);
position: relative;
overflow: visible;
border: 9px solid transparent;
border: var(--page-border);
background-clip: content-box;
border-image: url(images/shadow.png) 9 9 repeat;
background-color: rgba(255, 255, 255, 1);
Expand Down Expand Up @@ -79,8 +99,8 @@
.spread .page,
.pdfViewer.scrollHorizontal .page,
.pdfViewer.scrollWrapped .page {
margin-left: -3.5px;
margin-right: -3.5px;
margin-left: var(--spreadHorizontalWrapped-margin-LR);
margin-right: var(--spreadHorizontalWrapped-margin-LR);
}

.pdfViewer.removePageBorders .spread .page,
Expand Down
95 changes: 77 additions & 18 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
--scrollbar-color: auto;
--scrollbar-bg-color: auto;
--toolbar-icon-bg-color: rgba(0, 0, 0, 1);
--toolbar-icon-hover-bg-color: rgba(0, 0, 0, 1);

--sidebar-narrow-bg-color: rgba(237, 237, 240, 0.9);
--sidebar-toolbar-bg-color: rgba(245, 246, 247, 1);
--toolbar-bg-color: rgba(249, 249, 250, 1);
--toolbar-border-color: rgba(204, 204, 204, 1);
--button-hover-color: rgba(221, 222, 223, 1);
--toggled-btn-color: rgba(0, 0, 0, 1);
--toggled-btn-bg-color: rgba(0, 0, 0, 0.3);
--toggled-hover-active-btn-color: rgba(0, 0, 0, 0.4);
--dropdown-btn-bg-color: rgba(215, 215, 219, 1);
Expand All @@ -54,10 +56,12 @@
--sidebaritem-bg-color: rgba(0, 0, 0, 0.15);
--doorhanger-bg-color: rgba(255, 255, 255, 1);
--doorhanger-border-color: rgba(12, 12, 13, 0.2);
--doorhanger-hover-color: rgba(237, 237, 237, 1);
--doorhanger-hover-color: rgba(12, 12, 13, 1);
--doorhanger-hover-bg-color: rgba(237, 237, 237, 1);
--doorhanger-separator-color: rgba(222, 222, 222, 1);
--overlay-button-border: 0 none;
--overlay-button-bg-color: rgba(12, 12, 13, 0.1);
--overlay-button-hover-color: rgba(12, 12, 13, 0.3);
--overlay-button-hover-bg-color: rgba(12, 12, 13, 0.3);

--loading-icon: url(images/loading.svg);
--treeitem-expanded-icon: url(images/treeitem-expanded.svg);
Expand Down Expand Up @@ -108,12 +112,14 @@
--scrollbar-color: rgba(121, 121, 123, 1);
--scrollbar-bg-color: rgba(35, 35, 39, 1);
--toolbar-icon-bg-color: rgba(255, 255, 255, 1);
--toolbar-icon-hover-bg-color: rgba(255, 255, 255, 1);

--sidebar-narrow-bg-color: rgba(42, 42, 46, 0.9);
--sidebar-toolbar-bg-color: rgba(50, 50, 52, 1);
--toolbar-bg-color: rgba(56, 56, 61, 1);
--toolbar-border-color: rgba(12, 12, 13, 1);
--button-hover-color: rgba(102, 102, 103, 1);
--toggled-btn-color: rgba(255, 255, 255, 1);
--toggled-btn-bg-color: rgba(0, 0, 0, 0.3);
--toggled-hover-active-btn-color: rgba(0, 0, 0, 0.4);
--dropdown-btn-bg-color: rgba(74, 74, 79, 1);
Expand All @@ -129,10 +135,11 @@
--sidebaritem-bg-color: rgba(255, 255, 255, 0.15);
--doorhanger-bg-color: rgba(74, 74, 79, 1);
--doorhanger-border-color: rgba(39, 39, 43, 1);
--doorhanger-hover-color: rgba(93, 94, 98, 1);
--doorhanger-hover-color: rgba(249, 249, 250, 1);
--doorhanger-hover-bg-color: rgba(93, 94, 98, 1);
--doorhanger-separator-color: rgba(92, 92, 97, 1);
--overlay-button-bg-color: rgba(92, 92, 97, 1);
--overlay-button-hover-color: rgba(115, 115, 115, 1);
--overlay-button-hover-bg-color: rgba(115, 115, 115, 1);

/* This image is used in <input> elements, which unfortunately means that
* the `mask-image` approach used with all of the other images doesn't work
Expand All @@ -141,6 +148,26 @@
}
}

@media screen and (forced-colors: active) {
:root {
--main-color: ButtonText;
--button-hover-color: Highlight;
--doorhanger-hover-bg-color: Highlight;
--toolbar-icon-opacity: 1;
--toolbar-icon-bg-color: ButtonText;
--toolbar-icon-hover-bg-color: ButtonFace;
--toggled-btn-color: HighlightText;
--toggled-btn-bg-color: LinkText;
--doorhanger-hover-color: ButtonFace;
--doorhanger-border-color-whcm: 1px solid ButtonText;
--doorhanger-triangle-opacity-whcm: 0;
--overlay-button-border: 1px solid Highlight;
--overlay-button-hover-bg-color: Highlight;
--overlay-button-hover-color: ButtonFace;
--field-border-color: ButtonText;
}
}

* {
padding: 0;
margin: 0;
Expand Down Expand Up @@ -224,10 +251,12 @@ select {
html[dir="ltr"] #sidebarContainer {
transition-property: left;
left: calc(0px - var(--sidebar-width));
border-right: var(--doorhanger-border-color-whcm);
}
html[dir="rtl"] #sidebarContainer {
transition-property: right;
right: calc(0px - var(--sidebar-width));
border-left: var(--doorhanger-border-color-whcm);
}

#outerContainer.sidebarResizing #sidebarContainer {
Expand Down Expand Up @@ -535,6 +564,7 @@ html[dir="rtl"] .findbar .splitToolbarButton > .findNext {

.findbar label:hover,
.findbar input:focus + label {
color: var(--toggled-btn-color);
background-color: var(--button-hover-color);
}

Expand All @@ -549,6 +579,7 @@ html[dir="rtl"] #findInput {

.findbar .toolbarField[type="checkbox"]:checked + .toolbarLabel {
background-color: var(--toggled-btn-bg-color) !important;
color: var(--toggled-btn-color);
}

#findInput {
Expand Down Expand Up @@ -603,6 +634,7 @@ html[dir="rtl"] .secondaryToolbar {
border-radius: 2px;
box-shadow: 0 1px 5px var(--doorhanger-border-color),
0 0 0 1px var(--doorhanger-border-color);
border: var(--doorhanger-border-color-whcm);
}
.doorHanger:after,
.doorHanger:before,
Expand All @@ -615,6 +647,7 @@ html[dir="rtl"] .secondaryToolbar {
width: 0;
position: absolute;
pointer-events: none;
opacity: var(--doorhanger-triangle-opacity-whcm);
}
.doorHanger:after,
.doorHangerRight:after {
Expand Down Expand Up @@ -660,7 +693,7 @@ html[dir="ltr"] .doorHangerRight:before {
background-color: rgba(217, 217, 217, 1);
color: rgba(82, 82, 82, 1);
text-align: center;
padding: 3px 4px;
padding: 4px 5px;
margin: 5px;
}

Expand Down Expand Up @@ -727,13 +760,15 @@ html[dir="rtl"] .splitToolbarButton > .toolbarButton {
width: 28px;
height: 28px;
}
.overlayButton {
background-color: var(--overlay-button-bg-color);
}

.overlayButton:hover,
.overlayButton:focus {
background-color: var(--overlay-button-hover-color);
background-color: var(--overlay-button-hover-bg-color);
}

.overlayButton:hover > span,
.overlayButton:focus > span {
color: var(--overlay-button-hover-color);
}

.toolbarButton > span {
Expand Down Expand Up @@ -826,13 +861,23 @@ html[dir="rtl"] #toolbarViewerLeft > .toolbarButton:first-child {
}
.secondaryToolbarButton:hover,
.secondaryToolbarButton:focus {
background-color: var(--doorhanger-hover-color);
background-color: var(--doorhanger-hover-bg-color);
color: var(--doorhanger-hover-color);
}

.toolbarButton.toggled,
.splitToolbarButton.toggled > .toolbarButton.toggled,
.secondaryToolbarButton.toggled {
background-color: var(--toggled-btn-bg-color);
color: var(--toggled-btn-color);
}

.secondaryToolbarButton.toggled::before {
background-color: var(--toggled-btn-color);
}

.toolbarButton.toggled::before {
background-color: var(--toggled-btn-color);
}

.toolbarButton.toggled:hover:active,
Expand Down Expand Up @@ -878,16 +923,15 @@ html[dir="ltr"] .dropdownToolbarButton > select {
html[dir="rtl"] .dropdownToolbarButton > select {
padding-right: 4px;
}
.dropdownToolbarButton > select:hover {
background-color: var(--button-hover-color);
}

.dropdownToolbarButton > select:hover,
.dropdownToolbarButton > select:focus {
background-color: var(--button-hover-color);
color: var(--toggled-btn-color);
}

.dropdownToolbarButton > select > option {
background: var(--doorhanger-bg-color);
color: var(--main-color);
}

#customScaleOption {
Expand Down Expand Up @@ -921,12 +965,25 @@ html[dir="rtl"] .dropdownToolbarButton > select {
mask-size: cover;
}

.dropdownToolbarButton:hover::after,
.dropdownToolbarButton:focus::after,
.dropdownToolbarButton:active::after {
background-color: var(--toolbar-icon-hover-bg-color);
}

.toolbarButton::before {
opacity: var(--toolbar-icon-opacity);
top: 6px;
left: 6px;
}

.toolbarButton:hover::before,
.toolbarButton:focus::before,
.secondaryToolbarButton:hover::before,
.secondaryToolbarButton:focus::before {
background-color: var(--toolbar-icon-hover-bg-color);
}

.secondaryToolbarButton::before {
opacity: var(--doorhanger-icon-opacity);
top: 5px;
Expand Down Expand Up @@ -1248,9 +1305,8 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {

.toolbarLabel {
min-width: 16px;
padding: 6px;
padding: 7px;
margin: 2px;
border: 1px solid rgba(0, 0, 0, 0);
sawanm9000 marked this conversation as resolved.
Show resolved Hide resolved
border-radius: 2px;
color: var(--main-color);
font-size: 12px;
Expand All @@ -1261,10 +1317,10 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {
}

html[dir="ltr"] #numPages.toolbarLabel {
padding-left: 2px;
padding-left: 3px;
}
html[dir="rtl"] #numPages.toolbarLabel {
padding-right: 2px;
padding-right: 3px;
}

#thumbnailView {
Expand Down Expand Up @@ -1483,6 +1539,9 @@ html[dir="rtl"] .treeItemToggler::before {
width: auto;
margin: 3px 4px 2px !important;
padding: 2px 11px;
color: var(--main-color);
background-color: var(--overlay-button-bg-color);
border: var(--overlay-button-border) !important;
}

#overlayContainer {
Expand Down