light-dark()color-schemecolor-schemelight-dark()
(see html element or any container to define the theme context:.scheme-light — Forces the Light theme..scheme-dark — Forces the Dark theme..scheme-light-dark — Automatically toggles based on System/OS settings.<html class="scheme-light-dark">
<body>
<p-button>I follow the OS theme</p-button>
<div class="scheme-dark">
<p-heading>Dark Section</p-heading>
<p-button>I use the Dark theme</p-button>
</div>
</body>
</html>
color-scheme utility classes do more than just update PDS components—they act as a global "source of truth" for
your entire styling stack. When you apply a .scheme-* class, it automatically synchronizes the theme across all our
supported styling tools:text-primary) automatically
resolve to the correct light or dark values.color-scheme defined
on the parent container.color-scheme defined on the parent container..scheme-only-light or .scheme-only-dark on a page section that must remain light or dark independently of its
parent scheme. This is useful for fixed campaign sections or other page islands within a page that otherwise follows the
user's system preference..campaign-section {
--p-color-canvas: #0e0e12;
--p-color-primary: #fff;
}
<html class="scheme-light-dark">
<body>
<main>
<section class="campaign-section scheme-only-dark">Dark campaign content</section>
<section class="campaign-section scheme-only-light">Light campaign content</section>
</main>
</body>
</html>
.campaign-section {
background-color: var(--p-color-canvas);
color: var(--p-color-primary);
}
