checkboxes: Render border-color-matched SVGs in light and dark modes.

This obviates the need for the buggy use of a brightness filter,
which causes rendering problems on iOS devices and possibly others.
This commit is contained in:
Karl Stolley 2024-09-16 11:14:59 -05:00 committed by Tim Abbott
parent 8741c9e43f
commit da91ebc592
4 changed files with 12 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 700 B

View File

@ -929,8 +929,10 @@
--color-border-zulip-button: hsl(0deg 0% 80%);
--color-border-zulip-button-interactive: hsl(0deg 0% 60%);
/* Zulip-style checkbox colors. */
/* Zulip-style checkbox values. */
--color-border-rendered-checkbox: hsl(0deg 0% 0% / 60%);
/* The SVG must be adjusted when changing the border color above. */
--svg-url-rendered-checkbox: url("../images/checkbox.svg");
/* Emoji-picker colors */
--color-background-emoji-picker-popover: hsl(0deg 0% 93%);
@ -1357,8 +1359,10 @@
--color-border-zulip-button: hsl(0deg 0% 0% / 60%);
--color-border-zulip-button-interactive: var(--color-border-zulip-button);
/* Zulip-style checkbox colors. */
/* Zulip-style checkbox values. */
--color-border-rendered-checkbox: hsl(0deg 0% 100% / 40%);
/* The SVG must be adjusted when changing the border color above. */
--svg-url-rendered-checkbox: url("../images/checkbox-dark-mode.svg");
/* Emoji-picker colors */
--color-background-emoji-picker-popover: hsl(0deg 0% 0% / 20%);

View File

@ -31,15 +31,18 @@
the light-mode color value here as a fallback. */
border: 1px solid
var(--color-border-rendered-checkbox, hsl(0deg 0% 0% / 60%));
border-radius: 4px;
filter: brightness(0.8);
cursor: pointer;
}
&:checked ~ .rendered-checkbox {
background-image: url("../images/checkbox.svg");
/* As with the border color above, we duplicate
the light-mode SVG URL value here as a fallback. */
background-image: var(
--svg-url-rendered-checkbox,
url("../images/checkbox.svg")
);
background-size: 85%;
background-position: 50% 50%;
background-repeat: no-repeat;