# Hard coding dark classes

**URL:** <https://forums.realmacsoftware.com/t/hard-coding-dark-classes/52583>\
**Category:** Elements\
**Created:** [November 19, 2025, 8:15pm UTC](https://forums.realmacsoftware.com/t/hard-coding-dark-classes/52583 "2025-11-19T20:15:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [November 19, 2025, 8:15pm UTC](https://forums.realmacsoftware.com/t/hard-coding-dark-classes/52583/1 "2025-11-19T20:15:33Z")

</div>

So you can’t hard code something like this in a html stack:

```plaintext
  <p
    class="block w-auto h-auto text-text-50 dark:text-text-950 text-opacity-[100%] dark:text-opacity-[100%] font-heading text-xl font-[500] tracking-normal leading-normal not-italic text-shadow-none normal-case whitespace-none text-left"
    id=""
    >
        Some text here
    </p>

```

Well you can if the advanced setting “allow dark mode” is on.  
If you turn it off (allowing only light mode), you get the dark classes applied.

This essentially means we can’t hard code the dark classes in components anywhere, in case the user turns off the “allow dark mode”.

Well, we kind of can, if we go through hooks again, check if allow dark mode is true/false, and build some optional classes. Urggghhhh.

---

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [November 19, 2025, 8:27pm UTC](https://forums.realmacsoftware.com/t/hard-coding-dark-classes/52583/2 "2025-11-19T20:27:29Z")

</div>

When the user toggles off the “Allow dark mode” switch, these media queries should be nuked

 ![CleanShot 2025-11-19 at 8 .24.04@2x](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/0/3/03be1af1a10eb0a7d1bc89b6a4c5b07488736647.png)

Seems like a flaw in the intelligent tailwind build on preview / publish, not accounting for the value of rw.project.allowDarkMode, as in edit all is well.
