0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Improve high contrast mode with the dev overlay (#9218)

* Improve high contrast mode with the dev overlay

* Update packages/astro/src/runtime/client/dev-overlay/overlay.ts

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
Matthew Phillips 2023-11-29 11:08:16 -05:00 committed by GitHub
parent 279e3c1b3d
commit f4401c8c1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Improve high contrast mode with the Dev Overlay

View file

@ -83,6 +83,12 @@ export class AstroDevOverlay extends HTMLElement {
box-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01); box-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01);
} }
@media (forced-colors: active) {
#dev-bar {
background: white;
}
}
#dev-bar .item { #dev-bar .item {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -132,6 +138,7 @@ export class AstroDevOverlay extends HTMLElement {
pointer-events: none; pointer-events: none;
} }
#dev-bar .item-tooltip::after{ #dev-bar .item-tooltip::after{
content: ''; content: '';
position: absolute; position: absolute;
@ -147,6 +154,12 @@ export class AstroDevOverlay extends HTMLElement {
opacity: 1; opacity: 1;
} }
@media (forced-colors: active) {
#dev-bar .item:hover .item-tooltip, #dev-bar .item:not(.active):focus-visible .item-tooltip {
background: white;
}
}
#dev-bar #bar-container .item.active .notification { #dev-bar #bar-container .item.active .notification {
border-color: rgba(71, 78, 94, 1); border-color: rgba(71, 78, 94, 1);
} }
@ -165,6 +178,12 @@ export class AstroDevOverlay extends HTMLElement {
margin: auto; margin: auto;
} }
@media (forced-colors: active) {
#dev-bar .item svg path[fill="#fff"] {
fill: black;
}
}
#dev-bar .item .notification { #dev-bar .item .notification {
display: none; display: none;
position: absolute; position: absolute;

View file

@ -315,6 +315,12 @@ export default {
#integration-list astro-dev-overlay-card p { #integration-list astro-dev-overlay-card p {
font-size: 14px; font-size: 14px;
} }
@media (forced-colors: active) {
svg path[fill="#fff"] {
fill: black;
}
}
</style> </style>
<header> <header>

View file

@ -34,7 +34,19 @@ export class DevOverlayIcon extends HTMLElement {
} }
buildTemplate() { buildTemplate() {
this.shadowRoot.innerHTML = `<style>svg { width: 100%; height: 100%;}</style>\n${this.getIconHTML( this.shadowRoot.innerHTML = `
<style>
svg {
width: 100%;
height: 100%;
}
@media (forced-colors: active) {
svg path[fill="#fff"] {
fill: black;
}
}
</style>\n${this.getIconHTML(
this._icon this._icon
)}`; )}`;
} }

View file

@ -30,6 +30,14 @@ export class DevOverlayToggle extends HTMLElement {
position: relative; position: relative;
} }
@media (forced-colors: active) {
input::after {
border: 1px solid black;
top: 0px;
left: 0px;
}
}
input:checked { input:checked {
border: 1px solid rgba(213, 249, 196, 1); border: 1px solid rgba(213, 249, 196, 1);
background-color: rgba(61, 125, 31, 1); background-color: rgba(61, 125, 31, 1);

View file

@ -30,6 +30,12 @@ export class DevOverlayWindow extends HTMLElement {
box-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01); box-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01);
} }
@media (forced-colors: active) {
:host {
background: white;
}
}
::slotted(h1), ::slotted(h2), ::slotted(h3), ::slotted(h4), ::slotted(h5) { ::slotted(h1), ::slotted(h2), ::slotted(h3), ::slotted(h4), ::slotted(h5) {
font-weight: 600; font-weight: 600;
color: #fff; color: #fff;