Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Karl Stolleyda91ebc592ea
diff --git a/web/images/checkbox-dark-mode.svg b/web/images/checkbox-dark-mode.svg
new file mode 100644
index 00000000000..40494abb459
--- /dev/null
+++ b/web/images/checkbox-dark-mode.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="96px" height="96px" viewBox="21 0 75 75" enable-background="new 0 0 96 96" xml:space="preserve">
+<g>
+ <path fill="#ffffff" fill-opacity="0.40" d="M49.844,68.325c-1.416,0-2.748-0.554-3.75-1.557L27.523,48.191c-1.003-1.002-1.555-2.334-1.555-3.75 s0.552-2.749,1.555-3.75c1.001-1.001,2.333-1.552,3.75-1.552s2.75,0.551,3.753,1.553l14.019,14.017L82.14,5.504 c0.989-1.468,2.639-2.345,4.412-2.345c1.054,0,2.075,0.312,2.956,0.902c2.424,1.631,3.07,4.934,1.439,7.361L54.25,65.98 c-0.892,1.316-2.312,2.162-3.895,2.314C50.17,68.315,50.01,68.325,49.844,68.325z"/>
+</g>
+</svg>
diff --git a/web/images/checkbox.svg b/web/images/checkbox.svg
index 006c527a46a..6f17bc04452 100644
--- a/web/images/checkbox.svg
+++ b/web/images/checkbox.svg
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="96px" height="96px" viewBox="21 0 75 75" enable-background="new 0 0 96 96" xml:space="preserve">
<g>
- <path fill="#999" d="M49.844,68.325c-1.416,0-2.748-0.554-3.75-1.557L27.523,48.191c-1.003-1.002-1.555-2.334-1.555-3.75 s0.552-2.749,1.555-3.75c1.001-1.001,2.333-1.552,3.75-1.552s2.75,0.551,3.753,1.553l14.019,14.017L82.14,5.504 c0.989-1.468,2.639-2.345,4.412-2.345c1.054,0,2.075,0.312,2.956,0.902c2.424,1.631,3.07,4.934,1.439,7.361L54.25,65.98 c-0.892,1.316-2.312,2.162-3.895,2.314C50.17,68.315,50.01,68.325,49.844,68.325z"/>
+ <path fill="#000000" fill-opacity="0.60" d="M49.844,68.325c-1.416,0-2.748-0.554-3.75-1.557L27.523,48.191c-1.003-1.002-1.555-2.334-1.555-3.75 s0.552-2.749,1.555-3.75c1.001-1.001,2.333-1.552,3.75-1.552s2.75,0.551,3.753,1.553l14.019,14.017L82.14,5.504 c0.989-1.468,2.639-2.345,4.412-2.345c1.054,0,2.075,0.312,2.956,0.902c2.424,1.631,3.07,4.934,1.439,7.361L54.25,65.98 c-0.892,1.316-2.312,2.162-3.895,2.314C50.17,68.315,50.01,68.325,49.844,68.325z"/>
</g>
</svg>
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 8895022ca68..dcd00b70625 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -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%);
diff --git a/web/styles/components.css b/web/styles/components.css
index ef45040e9f9..57092c26f7f 100644
--- a/web/styles/components.css
+++ b/web/styles/components.css
@@ -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;