Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Heise jan-heise

View GitHub Profile
@jan-heise
jan-heise / readme.md
Created Apr 22, 2020
Enable Darkmode Variants in TailwindUI depending on OS / Browser Settings
View readme.md

Enable Darkmode Variants in TailwindUI depending on OS / Browser Settings

To enable darkmode variants simply add the following lines to the theme/extend section of your tailwind config

screens: {
    'dark-mode': {'raw': '(prefers-color-scheme: dark)'},
},

This enables the dark-mode variant for your classes. You are now able to use dark-mode:bg-gray-900 on your site.