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.

highlight: Fix color contrast and theming in dark mode.

faithlee5d2650784838
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 98d35488dc0..6ebe0255cd7 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -1874,6 +1874,11 @@
transparent,
var(--color-markdown-pre-border)
);
+ --color-background-search-highlight: light-dark(
+ hsl(51deg 100% 79%),
+ hsl(51deg 100% 72%)
+ );
+ --color-text-search-highlight: light-dark(currentcolor, hsl(0deg 0% 0%));
--color-text-alert-word: light-dark(currentcolor, hsl(0deg 0% 0%));
--color-markdown-link: light-dark(
hsl(200deg 100% 40%),
@@ -1885,6 +1890,14 @@
var(--color-text-generic-link-interactive)
);
--color-markdown-code-link-hover: var(--color-markdown-link-hover);
+ --color-markdown-link-highlight: light-dark(
+ hsl(200deg 100% 40%),
+ hsl(210deg 100% 25%)
+ );
+ --color-markdown-link-highlight-hover: light-dark(
+ hsl(200deg 100% 25%),
+ hsl(210deg 100% 18%)
+ );
--color-markdown-link-alert-word: light-dark(
hsl(200deg 100% 40%),
hsl(210deg 100% 25%)
diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.css
index 9ddf36ad94f..a860a1b40a1 100644
--- a/web/styles/dark_theme.css
+++ b/web/styles/dark_theme.css
@@ -219,11 +219,6 @@
background-color: hsl(0deg 0% 0% / 20%);
}
- /* Search highlight used in both topics and rendered_markdown */
- .highlight {
- background-color: hsl(51deg 100% 23%);
- }
-
.searching-for-more-topics img {
filter: invert(100%);
}
diff --git a/web/styles/rendered_markdown.css b/web/styles/rendered_markdown.css
index b1921d87e13..644df54d206 100644
--- a/web/styles/rendered_markdown.css
+++ b/web/styles/rendered_markdown.css
@@ -1104,7 +1104,28 @@
/* Search highlight used in both topics and rendered_markdown */
.highlight {
- background-color: hsl(51deg 100% 79%);
+ background-color: var(--color-background-search-highlight);
+ color: var(--color-text-search-highlight);
+}
+
+/* Link styles that are also related to search highlights */
+a:not(.icon-button) {
+ &:has(.highlight) {
+ &:hover,
+ &:focus {
+ text-decoration-color: var(--color-markdown-link-highlight-hover);
+ }
+ }
+
+ & .highlight {
+ color: var(--color-markdown-link-highlight);
+ font-weight: 500;
+ }
+
+ &:hover .highlight,
+ &:focus .highlight {
+ color: var(--color-markdown-link-highlight-hover);
+ }
}
/* For elements where we want to show as much markdown content we can