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

Improve high contrast mode with the dev overlay #9218

Merged
merged 2 commits into from
Nov 29, 2023
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
5 changes: 5 additions & 0 deletions .changeset/grumpy-seas-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Improve high contrast mode with the Dev Overlay
19 changes: 19 additions & 0 deletions packages/astro/src/runtime/client/dev-overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

@media (forced-colors: active) {
#dev-bar {
background: white;
}
}

#dev-bar .item {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -132,6 +138,7 @@ export class AstroDevOverlay extends HTMLElement {
pointer-events: none;
}


#dev-bar .item-tooltip::after{
content: '';
position: absolute;
Expand All @@ -147,6 +154,12 @@ export class AstroDevOverlay extends HTMLElement {
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 {
border-color: rgba(71, 78, 94, 1);
}
Expand All @@ -165,6 +178,12 @@ export class AstroDevOverlay extends HTMLElement {
margin: auto;
}

@media (forced-colors: active) {
#dev-bar .item svg path[fill="#fff"] {
fill: black;
}
}

#dev-bar .item .notification {
display: none;
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ export default {
#integration-list astro-dev-overlay-card p {
font-size: 14px;
}

@media (forced-colors: active) {
svg path[fill="#fff"] {
fill: black;
}
}
</style>

<header>
Expand Down
14 changes: 13 additions & 1 deletion packages/astro/src/runtime/client/dev-overlay/ui-library/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ export class DevOverlayIcon extends HTMLElement {
}

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
)}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ export class DevOverlayToggle extends HTMLElement {
position: relative;
}

@media (forced-colors: active) {
input::after {
border: 1px solid black;
top: 0px;
left: 0px;
}
}

input:checked {
border: 1px solid rgba(213, 249, 196, 1);
background-color: rgba(61, 125, 31, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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);
}

@media (forced-colors: active) {
:host {
background: white;
}
}

::slotted(h1), ::slotted(h2), ::slotted(h3), ::slotted(h4), ::slotted(h5) {
font-weight: 600;
color: #fff;
Expand Down
Loading