Porsche Design System
You are currently viewing an earlier release of the Porsche Design System.Switch to the latest Porsche Design System documentation.
SearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Theme Table of Contents How it works The new color system leverages the native CSS light-dark() function. By adopting this browser-native engine, we have eliminated proprietary switching logic in favor of a performant, standardized architecture that responds instantly to user preferences. The Foundation: color-scheme All system colors are controlled via the CSS color-scheme property and are included in our mandatory Global Styles. These styles also provide utility classes for selecting the active theme and a polyfill to ensure compatibility with browsers that do not yet support light-dark() (see browser support). Apply these classes to the 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. Scoping Themes Theme context is hierarchical. You can nest these utility classes to create "islands" of different themes within your application. This is particularly useful for dark-themed footers or light-themed modals on dark pages.
<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 am always Dark</p-button> </div> </body> </html>
Ecosystem Integration The 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: Tailwind CSS: Custom PDS color utilities (e.g., text-primary) automatically resolve to the correct light or dark values. SCSS: The PDS mixins and variables hook into the theme context, ensuring your custom stylesheets remain brand-compliant. Emotion: Design tokens consumed via Emotion are reactive to the color-scheme defined on the parent container. Vanilla Extract: Design tokens consumed via Vanilla Extract are reactive to the color-scheme defined on the parent container. Key Takeaway: By using these utility classes, you ensure that your custom UI and PDS components always share the same color palette and contrast ratios, regardless of the styling technology used.
Global settingsColor SchemeAll color tokens use the light-dark() CSS function. Set the theme via the CSS color-scheme property: light for light mode, dark for dark mode, or light dark to follow the user's system preference.LightDarkLight DarkDirectionThe dir global attribute in HTML changes the direction of text and other content within an element. It's most often used on the <html> tag to set the entire page's direction, which is crucial for supporting languages that are written from right to left (RTL), such as Arabic and Hebrew. For example, using <html dir="rtl"> makes the entire page display from right to left, adjusting the layout and text flow accordingly.LTR (left-to-right)RTL (right-to-left)Text ZoomTo ensure accessibility and comply with WCAG 2.2 AA standards, it is mandatory for web content to support text resizing up to at least 200% without loss of content or functionality. Using relative units like rem is a best practice for achieving this, as they allow the text to scale uniformly based on the user's browser settings.100%130%150%200%