From d82f7b7dd13788fd5478b72285cde1cb76041d4d Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Tue, 10 May 2022 23:30:13 -0400 Subject: [PATCH] Make archive file icon shadows visible in dark mode. On a black background, the black icon shadows are invisible. This is not a huge problem but we can use CSS rules to make them visible again. To do this, the SVG embedding is adjusted to automatically add classes based on the filename in order to differentiate between the various images, and additional classes are added to the icons to enable selectors to match the shadows. The results seem OK. --- content/icons/down.svg | 2 ++ content/icons/folder.svg | 3 +++ content/icons/return.svg | 2 ++ content/icons/up.svg | 2 ++ content/style.scss | 7 +++++++ layouts/embed-svg.xsl | 20 ++++++++++++++++++-- 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/content/icons/down.svg b/content/icons/down.svg index 95b82af..0c05c06 100644 --- a/content/icons/down.svg +++ b/content/icons/down.svg @@ -67,6 +67,7 @@ diff --git a/content/icons/folder.svg b/content/icons/folder.svg index 79b25c3..ff2f8d7 100644 --- a/content/icons/folder.svg +++ b/content/icons/folder.svg @@ -42,6 +42,7 @@ r="117.14286" /> diff --git a/content/icons/up.svg b/content/icons/up.svg index 54263df..63e8db3 100644 --- a/content/icons/up.svg +++ b/content/icons/up.svg @@ -89,6 +89,7 @@ diff --git a/content/style.scss b/content/style.scss index fb33f88..727a865 100644 --- a/content/style.scss +++ b/content/style.scss @@ -454,6 +454,13 @@ ul.ordered > { #footer { padding: 0 1em; } } +// lighten icon shadows in dark mode +@media (prefers-color-scheme: dark) { + svg.icons { path.shadow, g.shadow>* { opacity: 0.7; } } + svg.icons .shadow>stop { stop-color: #aaa; } + svg.return path.shadow { opacity: 0.45; } +} + // page-specific dark mode styles @media (prefers-color-scheme: dark) and (min-width: 35em) { #page_weblog_responsive_tables { diff --git a/layouts/embed-svg.xsl b/layouts/embed-svg.xsl index 2b3f8e2..0aee04d 100644 --- a/layouts/embed-svg.xsl +++ b/layouts/embed-svg.xsl @@ -2,7 +2,7 @@ + + + + + + + + + + + -- 2.43.2