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.

starlight_help: Display gradient for the idle status icon.

Shubham Padia5938f685ad16
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index b38d21eed2b..11d388f571f 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -979,6 +979,11 @@ svg_rules = RuleList(
"pattern": r"fill=(['\"])(.*?)\1",
"description": "System icons ignore fill values, so do not include the fill property.",
"include_only": {"web/shared/icons/", "web/images/icons/"},
+ # This file needs the fill property to define the fill as
+ # a linear gradient. We cannot define the gradient in CSS
+ # in a clean way and thus we have decided to define the
+ # gradient in the SVG itself.
+ "exclude": {"web/shared/icons/user-circle-idle.svg"},
},
{
"pattern": "fill:",
diff --git a/web/shared/icons/user-circle-idle.svg b/web/shared/icons/user-circle-idle.svg
index 642e028a611..f590992bf68 100644
--- a/web/shared/icons/user-circle-idle.svg
+++ b/web/shared/icons/user-circle-idle.svg
@@ -1,4 +1,18 @@
+<!--
+The linearGradient in this SVG is trying to emulate the gradient that
+the user-circle-idle class applies to this SVG for the new help center
+built on top of starlight. This linearGradient would not have any
+effect on the current webapp icon since the gradient in this SVG is
+stripped off when the webapp converts this SVG to font.
+-->
<svg viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg">
- <path d="M 0 5.5 C 0 2.462433 2.462432 0 5.5 0 C 8.53754 0 11 2.462433 11 5.5 C 11 8.53754 8.53754 11 5.5 11 C 2.462432 11 0 8.53754 0 5.5 Z"/>
+ <defs>
+ <linearGradient id="user-circle-idle-gradient" x1="0%" y1="0%" x2="100%" y2="0%">
+ <stop offset="5%" stop-color="var(--color-user-circle-idle)" stop-opacity="1" />
+ <stop offset="25%" stop-color="var(--color-user-circle-idle)" stop-opacity="0.789" />
+ <stop offset="100%" stop-color="var(--color-user-circle-idle)" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <path d="M 0 5.5 C 0 2.462433 2.462432 0 5.5 0 C 8.53754 0 11 2.462433 11 5.5 C 11 8.53754 8.53754 11 5.5 11 C 2.462432 11 0 8.53754 0 5.5 Z"
+ fill="url(#user-circle-idle-gradient)"/>
</svg>
-
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index c30129087d9..5065242ccca 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -1638,6 +1638,12 @@
#646671
);
--color-user-circle-deactivated: hsl(0deg 0% 50%);
+ /* The gradient is also recreated inside the `user-circle-idle` SVG
+ file. That is needed for the new help center since it does not
+ do the SVG to font conversion that the web app does. We
+ re-apply it here since the linearGradient there is stripped off
+ when that SVG is converted to font for the web app. Any changes
+ to this gradient should be reflected in the SVG file as well. */
--gradient-user-circle-idle: linear-gradient(
to right,
var(--color-user-circle-idle) 5%,