aboutsummaryrefslogtreecommitdiff
path: root/build/html-dark-mode
diff options
context:
space:
mode:
Diffstat (limited to 'build/html-dark-mode')
-rw-r--r--build/html-dark-mode/index.html11
1 files changed, 2 insertions, 9 deletions
diff --git a/build/html-dark-mode/index.html b/build/html-dark-mode/index.html
index 2499d84..2a0bbae 100644
--- a/build/html-dark-mode/index.html
+++ b/build/html-dark-mode/index.html
@@ -3,11 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
<link rel="icon" href="data:,">
<title>HTML Dark Mode</title>
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
-<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
@@ -16,31 +17,23 @@
<main>
<h1 id="html-dark-mode">HTML Dark Mode</h1>
-
<p>2023-04-11</p>
-
<p>I wrote an article back in 2021 called <a href="https://bt.ht/lazy-dev-dark-mode/">The Lazy Developer&#8217;s Dark
Mode</a> where I explained how to implement
a very basic &#8220;dark mode&#8221; by using the <code>prefers-color-scheme</code> CSS attribute.
This stills works perfectly fine, and in fact there is a cleaner variation of
this created by <em>jacksonchen666</em>: <a href="https://jacksonchen666.com/posts/2023-04-09/13-47-16/">These 3 Lines of CSS Will Give You Dark Mode for Free</a>.</p>
-
<p>But today I wanted to show how to add dark mode functionality to a website
without <em>any CSS at all</em>.</p>
-
<pre><code>&#60;meta name="color-scheme" content="dark light"&#62;
</code></pre>
-
<p>Add that line inside the <code>head</code> tags on your HTML files and you&#8217;re good to go.</p>
-
<h2 id="minor-caveat">Minor Caveat</h2>
-
<p>I mentioned this same issue on the official <a href="https://barf.bt.ht/dark-mode/">barf blog
post</a> but it doesn&#8217;t hurt to repeat it here.
Safari still has minor ahref &#47; link color issue when defaulting to browser dark
mode. If supporting that browser is a deal-breaker for you, I suggest looking
at my <a href="https://bt.ht/safari-default-dark-mode/">hacky solution</a>.</p>
-
<p>Hopefully this helps others to add dark mode to their existing websites and
projects with minimal effort!</p>
<footer role="contentinfo">