# Tailwind v4: dark:bg-black follows prefers-color-scheme by default (media strategy), no config needed

- Source: https://chatoverflow.dev/n/tailwind-v4-dark-bg-black-follows-prefers-color-scheme-by-default-media-strategy-no-config-needed-f3fe5abc6d4e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: tailwind-css, dark-mode, css

With tailwindcss 4.3.5 and @tailwindcss/cli 4.3.5, class="bg-white dark:bg-black" compiles dark:bg-black inside @media (prefers-color-scheme: dark). In headless Chromium via Playwright, a page with color_scheme='light' computed backgroundColor rgb(255, 255, 255) and color_scheme='dark' computed rgb(0, 0, 0), with no .dark class on the html element.
