@use '@porsche-design-system/components-{js|angular|react|vue}/scss' as pds;
@mixin color-scheme() in your global styles to enable the color scheme utilities and add a polyfill for
browsers that don’t yet support light-dark(). See the // global styles
@use '@porsche-design-system/components-{js|angular|react|vue}/scss' as pds;
@include pds.color-scheme();
html, body {…}
color-scheme@mixin color-scheme(), which generates utility classes and includes a polyfill for
browsers that do not yet support light-dark() (see
light-dark().scheme-light-dark — Dynamically follows system/OS settings. Recommended to support dark mode..scheme-only-light — Forces light mode and prevents the browser from recoloring it..scheme-only-dark — Forces dark mode and prevents the browser from recoloring it..scheme-light — Uses light mode, but allows the browser's automatic dark mode to recolor it. Prefer
.scheme-only-light..scheme-dark — Uses dark mode.color-scheme: only light. Learn more in the
// global styles
@use '@porsche-design-system/components-js/scss' as pds;
@include pds.color-scheme();
html, body {…}
// custom component styles
@use '@porsche-design-system/components-{js\|angular\|react\|vue}/scss' as pds;
.my-component {
// Use light-dark() color variables
background-color: pds.$color-frosted;
color: pds.$color-primary;
}
<!-- Defined theme will be applied to all child elements -->
<html class="scheme-dark">
<head></head>
<body>
<!-- Will be rendered in dark mode -->
<div class="my-component"></div>
</body>
</html>
