diff options
author | 2024-01-05 17:31:11 +0800 | |
---|---|---|
committer | 2024-01-05 18:11:00 +0800 | |
commit | 7b5435a9855111dd34422ff0067c1955c43875eb (patch) | |
tree | e535072810586006d03129ee47ef0dbbe04dcb1d /pydis_site/static | |
parent | Dark: Support system color scheme preference (diff) |
Dark: Fix hero colors on homepage
We can now use `[data-theme="dark"]` selector in CSS to defined styles
specifically for dark mode. This follows common web dev patterns and
gives little overhead.
- Hero
- Added `wave_black` SVG which copies `wave_white` as is but uses the
site's dark mode background color.
Diffstat (limited to 'pydis_site/static')
-rw-r--r-- | pydis_site/static/css/home/index.css | 10 | ||||
-rw-r--r-- | pydis_site/static/images/waves/wave_black.svg | 77 | ||||
-rw-r--r-- | pydis_site/static/js/base/navbar.js | 2 |
3 files changed, 89 insertions, 0 deletions
diff --git a/pydis_site/static/css/home/index.css b/pydis_site/static/css/home/index.css index e117a35b..23e27be1 100644 --- a/pydis_site/static/css/home/index.css +++ b/pydis_site/static/css/home/index.css @@ -91,6 +91,11 @@ h1 { height: 26px; z-index: 3; } +[data-theme="dark"] { + #bottom-wave { + background: url(../../images/waves/wave_black.svg) repeat-x !important; + } +} @keyframes wave { 0% { @@ -176,6 +181,11 @@ h1 { #projects .card:hover .card-header-title { color: #363636; } +[data-theme="dark"] { + #projects .card:hover .card-header-title { + color: #CAD6FF; + } +} #projects .card-content { padding-top: 8px; diff --git a/pydis_site/static/images/waves/wave_black.svg b/pydis_site/static/images/waves/wave_black.svg new file mode 100644 index 00000000..899fe2f9 --- /dev/null +++ b/pydis_site/static/images/waves/wave_black.svg @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1600" + height="28.745832" + version="1.1" + id="svg11" + sodipodi:docname="wavew.svg" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> + <metadata + id="metadata15"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="2560" + inkscape:window-height="1409" + id="namedview13" + showgrid="false" + inkscape:zoom="1.44625" + inkscape:cx="884.40031" + inkscape:cy="-61.865141" + inkscape:window-x="4880" + inkscape:window-y="677" + inkscape:window-maximized="1" + inkscape:current-layer="svg11" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + <defs + id="defs7"> + <linearGradient + id="a" + x1="0.5" + x2="0.5" + y1="-0.10958999" + y2="1"> + <stop + stop-color="#57BBC1" + stop-opacity=".25" + offset="0%" + id="stop2" /> + <stop + stop-color="#015871" + offset="100%" + id="stop4" /> + </linearGradient> + </defs> + <path + fill="url(#a)" + fill-rule="evenodd" + d="M 1599.995,17.566918 C 1289,17.566918 1190.102,-0.03623696 789,5.6042811e-5 389,5.6042811e-5 289,17.566918 0,17.566918 v 11.178914 h 1600 c 0,0 -0.01,-6.968673 -0.01,-11.178914 z" + id="path9" + style="fill:#2C2F33;fill-opacity:1;stroke-width:0.381026" /> +</svg> diff --git a/pydis_site/static/js/base/navbar.js b/pydis_site/static/js/base/navbar.js index 04850add..2a57cad4 100644 --- a/pydis_site/static/js/base/navbar.js +++ b/pydis_site/static/js/base/navbar.js @@ -30,6 +30,8 @@ function setStyleSheets(newTheme) { darkStylesheet.disabled = false; break; } + + document.querySelector("html").setAttribute("data-theme", newTheme); } // Reflect chosen theme on the switch toggle. |