From f0b675cddcbfbf1b7767391327f5087b09dc01d4 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Fri, 16 Aug 2024 16:18:35 -0500 Subject: [PATCH] theme toggle tweaks - use standard sun/moon icons - reduce button size by .5rem --- layouts/partials/head.html | 2 +- layouts/partials/header.html | 14 +++++++++--- static/css/custom.css | 42 +++++++++++++++++++++++++----------- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4691e45..2ea6652 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -33,7 +33,7 @@ })(); - + diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c3435de..edcbad4 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -8,7 +8,15 @@ \ No newline at end of file diff --git a/static/css/custom.css b/static/css/custom.css index 41d797f..1941c41 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -70,12 +70,39 @@ body { border: none; cursor: pointer; padding: 0; - width: 2rem; - height: 2rem; + width: 1.5rem; + height: 1.5rem; z-index: 1000; transition: opacity 0.3s ease; } +.theme-toggle__icon { + width: 100%; + height: 100%; + transition: opacity 0.3s ease; +} + +.theme-toggle__icon svg { + width: 100%; + height: 100%; + fill: var(--off-fg); + transition: fill 0.3s ease; +} + +.theme-toggle:hover .theme-toggle__icon svg { + fill: var(--hover); +} + +.theme-toggle__icon--sun, +[data-theme="dark"] .theme-toggle__icon--moon { + display: none; +} + +[data-theme="dark"] .theme-toggle__icon--sun, +.theme-toggle__icon--moon { + display: block; +} + .theme-toggle:hover { opacity: 0.7; } @@ -89,21 +116,10 @@ body { outline-offset: 2px; } -.theme-toggle__icon { - width: 100%; - height: 100%; - transition: transform 0.3s ease, fill 0.3s ease; - fill: var(--off-fg); -} - .theme-toggle:hover .theme-toggle__icon { fill: var(--hover); } -[data-theme="dark"] .theme-toggle__icon { - transform: rotate(180deg); -} - .page__nav ul { padding-right: 3rem; }