# C'è un modo per rilevare l'uso della modalità scura?

**URL:** https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821
**Category:** Development
**Created:** [16 Aprile 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:** 2

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [16 Aprile 2023, 10:39am UTC](https://meta.discourse.org/t/is-there-a-way-to-detect-dark-mode-usage/261821/2 "2023-04-16T10:39:50Z")

</div>

> [@ti0](#):
>
> rilevare se il tema corrente sta utilizzando la modalità scura

Ciao,

Penso che ci siano alcuni modi per raggiungere questo obiettivo.

Puoi usare questo

> [@No specific class for dark mode](https://meta.discourse.org/t/no-specific-class-for-dark-mode/254984/2?u=dodesz):
>
> Would this accomplish what you need? this would need to be added to color\_definitions.scss @if #{schemeType()} == dark { body { background: red; } } @else { body { background: blue; } } A class does seem like it would be useful though, we can probably add one.

Oppure questo

> [@Why might dark-light-choose() not work?](https://meta.discourse.org/t/why-might-dark-light-choose-not-work/172232/2?u=dodesz):
>
> I believe, due to the way the SCSS is compiled, custom dark/light definitions need to be added to color\_definitions.scss within a theme and won’t work in other scss files. color\_definitions.scss is high up in the cascade (before a lot of the default styles), so you don’t want to add the .modal.history-modal ins part there. Instead you can just add the color definition itself… $dark-theme-ins: #acf2bd; $light-theme-ins: #4da06d; $ins: dark-light-choose(…

* * *

Adoro la sezione **Argomenti Correlati** di Discourse Ai 😃 è molto più facile organizzare e trovare argomenti.

 ![Screenshot_20230416_122730](https://global.discourse-cdn.com/meta/original/4X/7/e/a/7ea6da30d8a6bd1d5d5428808b5063ceab021e37.jpeg)

---

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