JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8381
  • Score
    100M100P100Q130400F
  • License MIT

PostCSS plugin to copy CSS from dark theme media query to special class

Package Exports

  • postcss-dark-theme-class

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-dark-theme-class) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostCSS Dark Theme Class

PostCSS plugin to copy CSS from dark theme media query to special class (by default html.is-dark).

@media (prefers-color-scheme: dark) {
  html {
    --text-color: white
  }
  body {
    background: black
  }
}
@media (prefers-color-scheme: dark) {
  html {
    --text-color: white
  }
  body {
    background: black
  }
}
html.is-dark {
  --text-color: white
}
html.is-dark body {
  background: black
}

Options

darkClass

Type: string.

Default: is-dark.

html’s class, which will switch dark theme.

Usage

postcss([ require('postcss-dark-theme-class') ])

See PostCSS docs for examples for your environment.