diff options
author | bt <bt@web> | 2023-12-11 09:42:06 -0500 |
---|---|---|
committer | IkiWiki <ikiwiki.info> | 2023-12-11 09:42:06 -0500 |
commit | 2ec7326b8fe333f33a7deacf63676f395b85dc24 (patch) | |
tree | 194705b2eb692d17ea19c00b588d4ebb59535d2b /posts/html-dark-mode.md | |
parent | 6fa8d23fa263626b53616d0059d920bde58b784e (diff) |
Diffstat (limited to 'posts/html-dark-mode.md')
-rw-r--r-- | posts/html-dark-mode.md | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/posts/html-dark-mode.md b/posts/html-dark-mode.md index 224699f..051e701 100644 --- a/posts/html-dark-mode.md +++ b/posts/html-dark-mode.md @@ -1,30 +1,20 @@ -# HTML Dark Mode +[[!meta title="HTML Dark Mode"]] +[[!meta date="2023-04-11"]] -2023-04-11 +I wrote an article back in 2021 called [The Lazy Developer's Dark Mode](https://bt.ht/lazy-dev-dark-mode/) where I explained how to implement +a very basic "dark mode" by using the `prefers-color-scheme` CSS attribute. This stills works perfectly fine, and in fact there is a cleaner variation of this created by *jacksonchen666*: [These 3 Lines of CSS Will Give You Dark Mode for Free](https://jacksonchen666.com/posts/2023-04-09/13-47-16/). -I wrote an article back in 2021 called [The Lazy Developer's Dark -Mode](https://bt.ht/lazy-dev-dark-mode/) where I explained how to implement -a very basic "dark mode" by using the `prefers-color-scheme` CSS attribute. -This stills works perfectly fine, and in fact there is a cleaner variation of -this created by *jacksonchen666*: [These 3 Lines of CSS Will Give You Dark Mode for Free](https://jacksonchen666.com/posts/2023-04-09/13-47-16/). +But today I wanted to show how to add dark mode functionality to a website without *any CSS at all*. -But today I wanted to show how to add dark mode functionality to a website -without *any CSS at all*. -``` -<meta name="color-scheme" content="dark light"> -``` + <meta name="color-scheme" content="dark light"> + Add that line inside the `head` tags on your HTML files and you're good to go. ## Minor Caveat -I mentioned this same issue on the official [barf blog -post](https://barf.bt.ht/dark-mode/) but it doesn't hurt to repeat it here. -Safari still has minor ahref / link color issue when defaulting to browser dark -mode. If supporting that browser is a deal-breaker for you, I suggest looking -at my [hacky solution](https://bt.ht/safari-default-dark-mode/). +I mentioned this same issue on the official [barf blog post](https://barf.bt.ht/dark-mode/) but it doesn't hurt to repeat it here. Safari still has minor ahref / link color issue when defaulting to browser dark mode. If supporting that browser is a deal-breaker for you, I suggest looking at my [hacky solution](https://bt.ht/safari-default-dark-mode/). -Hopefully this helps others to add dark mode to their existing websites and -projects with minimal effort! +Hopefully this helps others to add dark mode to their existing websites and projects with minimal effort! |