Skip to content

Commit

Permalink
fix(config): fix dark mode extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Sep 6, 2021
1 parent 7f89b18 commit 2a89557
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/config/plugin-base.js
Expand Up @@ -3,22 +3,25 @@ const plugin = require('tailwindcss/plugin');
module.exports = () =>
plugin(({ addBase, config }) => {
const darkMode = config('darkMode');
const darkProps =
darkMode === 'class'
? {
'.dark': {
'--twm-hairline-color': 'rgba(255, 255, 255, 0.15)',
color: '#fff',
},
}
: {
'@media (prefers-color-scheme: dark)': {
':root': {
'--twm-hairline-color': 'rgba(255, 255, 255, 0.15)',
color: '#fff',
},
},
};
let darkProps = {};
if (darkMode === 'class') {
darkProps = {
'.dark': {
'--twm-hairline-color': 'rgba(255, 255, 255, 0.15)',
color: '#fff',
},
};
} else if (darkMode === 'media') {
darkProps = {
'@media (prefers-color-scheme: dark)': {
':root': {
'--twm-hairline-color': 'rgba(255, 255, 255, 0.15)',
color: '#fff',
},
},
};
}

addBase({
':root': {
'--twm-device-pixel-ratio': '1',
Expand Down

0 comments on commit 2a89557

Please sign in to comment.