# Is there a way to detect dark mode usage?

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821>\
**Category:** Development\
**Created:** [April 16, 2023, 2:45am UTC](https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821 "2023-04-16T02:45:02Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ti0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ti0/32/184402_2.png) [@ti0](https://meta.discourse.org/u/ti0)\
**Post date:** [April 16, 2023, 12:24pm UTC](https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821/4 "2023-04-16T12:24:29Z")

</div>

I resolved this by adding a single line of code to the Head section of each theme depending on the colors:

> document.body.classList.add(“dark-theme”);

> document.body.classList.add(“light-theme”);

Thanks for your inputs @Don @Lilly

---

_[View the full topic](https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821)._
