Skip to content

Commit

Permalink
use light-dark() function
Browse files Browse the repository at this point in the history
  • Loading branch information
basher committed Nov 14, 2024
1 parent c927cc8 commit 95fb621
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 50 deletions.
4 changes: 2 additions & 2 deletions ui/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ui/src/css/components/banner.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@

.banner__content {
/* So text is legible above image. */
@media (prefers-color-scheme: dark) {
color: var(--color-neutral-darkest);
}

background: var(--color-primary-100);
color: light-dark(
var(--color-neutral-darkest),
var(--color-neutral-darkest)
);
inline-size: 40vw;
margin-inline-start: var(--gutter-m);
padding: var(--gutter-m);
Expand Down
10 changes: 4 additions & 6 deletions ui/src/css/components/breadcrumb.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
.breadcrumb {
[aria-current] {
color: var(--color-primary-500);
color: light-dark(
var(--color-primary-500),
var(--color-neutral-lightest)
);
font-weight: bold;

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
color: inherit;
}
}
}

Expand Down
9 changes: 4 additions & 5 deletions ui/src/css/components/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@

.button--positive {
background-color: var(--color-success-500);
color: light-dark(
var(--color-neutral-darkest),
var(--color-neutral-darkest)
);

&[class*='text'] {
border-color: var(--color-success-500);
}

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
color: var(--color-neutral-darkest);
}
}

.button--negative {
Expand Down
10 changes: 4 additions & 6 deletions ui/src/css/components/nav.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
.nav {
[aria-current] {
color: var(--color-primary-500);
color: light-dark(
var(--color-primary-500),
var(--color-neutral-lightest)
);
font-weight: bold;

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
color: inherit;
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions ui/src/css/web-components/webui-image-gallery.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ webui-image-gallery {
}

.modal__close {
@media (prefers-color-scheme: dark) {
background: inherit;
}

background: var(--color-neutral-light);
margin: var(--gutter-s);
}
}
20 changes: 8 additions & 12 deletions ui/src/css/web-components/webui-modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,27 @@ webui-modal {

/* Browser already applies "position: fixed" and "width: fit-content". */
.modal__dialog {
background: var(--color-neutral-lightest);
background: light-dark(
var(--color-neutral-lightest),
var(--color-neutral-dark)
);
margin: auto;
padding: 0 var(--gutter-m) var(--gutter-m);

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
background: var(--color-neutral-dark);
}

&::backdrop {
background: var(--color-backdrop);
pointer-events: none; /* So click outside works */
}
}

.modal__header {
background: var(--color-neutral-lightest);
background: light-dark(
var(--color-neutral-lightest),
var(--color-neutral-dark)
);
display: flex;
justify-content: flex-end;
padding-block-start: var(--gutter-m);

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
background: var(--color-neutral-dark);
}
}

.modal__content {
Expand Down
18 changes: 8 additions & 10 deletions ui/src/css/web-components/webui-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ webui-tabs {
}

[role='tab'] {
background-color: var(--color-neutral-light);
background-color: light-dark(
var(--color-neutral-light),
var(--color-neutral-darkest)
);
color: light-dark(
var(--color-neutral-darkest),
var(--color-neutral-lightest)
);
padding: var(--gutter-s);
text-decoration: none;
transition: background-color var(--animation-fast);
Expand All @@ -57,15 +64,6 @@ webui-tabs {
background-color: var(--color-primary-500);
color: var(--color-neutral-lightest);
}

/* stylelint-disable-next-line order/order */
@media (prefers-color-scheme: dark) {
background-color: var(--color-neutral-medium);

&[aria-selected='true'] {
color: inherit;
}
}
}

[role='tabpanel'] {
Expand Down

0 comments on commit 95fb621

Please sign in to comment.