Skip to content

Commit db882ad

Browse files
edonehooandrew-ronaldsonjschulernicolethoencursoragent
authored
docs(theming): Adds details around new theme and glass mode. (#4983)
* docs(theming): Adds details around new unified theme. * docs(theming): Add new theming details. * docs(theming): Update theming docs. * Adds glass mode handbook outline draft. * Add tokens table and list of glass-supporting components. * Change name to Project Felt. * fix(theming doc): typo fix Corrected a typo in the Project Felt theme description. * Updates from PR feedback. * Apply suggestion from @edonehoo * feat: bump design-tokens package (#5002) * feat: bump design-tokens package * chore(deps): bump @patternfly/design-tokens to 1.16.2 Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: nicolethoen <nthoen@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.363 - @patternfly/documentation-framework@6.40.0 * fix: move generative AI docs and bump PF versions (#5007) * fix: move generative AI docs and bump PF versions * exclude compass demos' new location from ssr build * chore: remove stray patternfly-ai/components compass screenshots Co-authored-by: Cursor <cursoragent@cursor.com> * rebase after CompassPanel removed * Update packages/documentation-site/patternfly-docs/content/components/components-data.json Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/developer-guides/react-flow/ReactFlow.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.364 - @patternfly/documentation-framework@6.40.1 * Update CompassIntegrationsDemo.tsx * Update dashboard.tsx * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.365 - @patternfly/documentation-framework@6.40.2 * docs(content-design): Updates capitalization guidelines with recommendations for API references. (#5004) * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.366 - @patternfly/documentation-framework@6.40.3 * docs(content-design): Adds related icons to terminology table. (#4926) * docs(terminology): Add related icons to table. * Update column header. * Add hide icon --------- Co-authored-by: Andrew Ronaldson <aronalds@redhat.com> * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.367 - @patternfly/documentation-framework@6.40.4 * feat: added documentation for patternfly cli. (#5009) * feat: added documentation for patternfly cli. * chore: updated with comments from team. * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * fix: updated with review comments. * chore: updated with additional review comments. * chore: prereq. section. * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * Update packages/documentation-site/patternfly-docs/content/AI/patternfly-cli.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * chore: fixed code format --------- Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * chore(release): releasing packages [ci skip] - @patternfly/ast-helpers@1.4.0-alpha.368 - @patternfly/documentation-framework@6.41.0 * Updates from review feedback * Updates from feedback * Fix image path * Apply suggestion from @edonehoo * Update packages/documentation-site/patternfly-docs/content/foundations-and-styles/styles/theming/theming.md Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com> * Updates from pr review * Small edit in the high contrast handbook --------- Co-authored-by: Andrew Ronaldson <aronalds@redhat.com> Co-authored-by: Joachim Schuler <jdh.schuler@gmail.com> Co-authored-by: nicolethoen <nthoen@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: patternfly-build <patternfly-build@redhat.com> Co-authored-by: Donald Labaj <dlabaj@redhat.com> Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
1 parent 3e2e16b commit db882ad

6 files changed

Lines changed: 229 additions & 45 deletions

File tree

packages/documentation-site/patternfly-docs/content/foundations-and-styles/styles/colors/colors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ Status and state colors are indicators that communicate data and actions to user
191191

192192
To check the contrast between background and text colors, use a <a href="https://color.a11y.com/?wc3" target="_blank" className="pf-m-link">WCAG AA-compliance tool.</a>
193193

194+
Beyond our standard contrast ratio, we support a high contrast and a glass contrast mode, as documented in our [theming guidelines](/foundations-and-styles/theming#contrast-modes).
195+
194196
## Color families
195197
Our color palettes are organized into "families" that contain different shades of the same hue. In the following families, you can expand each color to see related tokens.
196198

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
id: Theming
3+
section: foundations-and-styles
4+
source: glass-mode-handbook
5+
---
6+
7+
# Glass mode developer handbook
8+
9+
Glass mode is a contrast mode option that can be manually enabled in both our Default and Project Felt themes. Glass adds transparency, blurring, and depth to the UI to create a more dynamic visual effect where brand-approved background images and layered UI elements subtly show through.
10+
11+
When turned on, glass applies to the following components, including their uses within our extensions:
12+
- Login page
13+
- Masthead
14+
- Navigation
15+
- Page
16+
17+
Additionally, glass can be manually enabled on the following components, via the `isGlass` prop:
18+
- Card
19+
- Drawer
20+
- Hero
21+
- Panel
22+
23+
Many components also support the `isPlain` prop, which removes their default solid background color so they can sit directly on a glass-enabled surface without obscuring the intended depth effect.
24+
25+
## Glass-specific component variants
26+
27+
When glass is enabled, two component variants are automatically applied in place of their standard counterparts to help anchor the experience:
28+
29+
- **Banded masthead:** Adds a solid fill color and shadowed border to the masthead, setting it apart as a persistent dock above the rest of the page.
30+
- **Floating side navigation:** Adds a solid fill color and shadowed border to the side navigation, insetting it to make it visually elevated and clearly readable as a navigation resource within the glass context.
31+
32+
## Background images
33+
34+
The glass effect is most visible when placed over a background image. To retain readability and ensure proper contrast ratios are met, images shouldn't contain high levels of detail or extreme contrast.
35+
36+
Background images, including non-branded and product-specific options are available to download from the [Red Hat brand portal](https://redhat.brand-portal.adobe.com/mediaportal.html/content/dam/mac/redhat/brand/brand-engagement-kit/wallpapers/product-interface-backgrounds?disableExpiredRedirect=true). If a Red Hat product team does not want to use one of the premade background options, then customized background images must be created in collaboration with the brand team.
37+
38+
Text must never be placed directly on a background image&mdash;it should be placed within a container that has a background color or glass effect. Titles or headings with stronger font weights can be placed directly on background images only if they pass specific brand and contrast requirements.
39+
40+
### Default background images
41+
42+
PatternFly includes background images for the glass theme and automatically applies them when you pull in PatternFly styles. Two sets of images are provided:
43+
44+
- **Default PatternFly theme:** `PF-Bkg-Generic-Light.svg` and `PF-Bkg-Generic-Dark.svg`
45+
- **Project Felt theme:** `Felt-Bkg-Generic-Light.svg` and `Felt-Bkg-Generic-Dark.svg`
46+
47+
The path to these images depends on how you pull in PatternFly styles.
48+
49+
**From `@patternfly/patternfly`** (typically via `@patternfly/patternfly/patternfly.css`):
50+
```
51+
@patternfly/patternfly/assets/images/
52+
```
53+
54+
**From `@patternfly/react-core`** (via `@patternfly/react-core/dist/styles/base.css`):
55+
```
56+
@patternfly/react-core/dist/styles/assets/images/
57+
```
58+
59+
As long as you include PatternFly CSS through one of those two methods, the background images will be applied automatically.
60+
61+
### Customizing background images
62+
63+
If you are not using one of the standard import paths, or you want to supply your own images, you can override the following CSS variables. Overrides should be scoped to the `:root` selector.
64+
65+
| Variable | Default value | Usage |
66+
| --- | --- | --- |
67+
| `--pf-t--global--background--image--glass` | `url("./assets/images/PF-Bkg-Generic-Light.svg")` | Default/glass light theme background image |
68+
| `--pf-t--global--background--image--glass--dark` | `url("./assets/images/PF-Bkg-Generic-Dark.svg")` | Default/glass dark theme background image |
69+
| `--pf-t--global--background--image--felt--glass` | `url("./assets/images/Felt-Bkg-Generic-Light.svg")` | Felt/glass light theme background image |
70+
| `--pf-t--global--background--image--felt--glass--dark` | `url("./assets/images/Felt-Bkg-Generic-Dark.svg")` | Felt/glass dark theme background image |
71+
72+
For example, to override both dark theme background images, add this to your application's CSS:
73+
74+
```css
75+
:root {
76+
--pf-t--global--background--image--glass--dark: url(../backgrounds/custom/my-glass-dark-image.jpg);
77+
--pf-t--global--background--image--felt--glass--dark: url(../backgrounds/custom/my-felt-glass-dark-image.jpg);
78+
}
79+
```
80+
81+
## Opacity
82+
83+
The default opacity values used in our components have been tested for accessibility, legibility, and visual appeal. Glass surfaces (page, masthead, navigation, and similar components) use 50% opacity in both light and dark mode, with a background blur effect applied.
84+
85+
If a product team chooses to override these token values, they are responsible for conducting their own accessibility evaluation to ensure WCAG compliance.
86+
87+
## Enabling glass mode
88+
89+
Glass mode is designed to work across light and dark color schemes in both our Default and Project Felt themes. To enable glass, add the class `.pf-v6-theme-glass` to your application’s `<html>` tag. When implementing glass, it’s important to ensure that it does not harm the overall accessibility or usability of your product.
90+
91+
### Technical constraints
92+
93+
There are a few technical constraints to abide by when using glass in your product.
94+
95+
- **No glass-on-glass layering:** Never layer glass-enabled containers. Doing so can cause significant performance and accessibility problems. For example, child objects inside a blurred parent container can become illegibly blurred themselves. To mitigate this, we have intentionally adjusted the opacity of our background color design tokens to simulate depth without introducing extra blur.
96+
- **High contrast precedence:** If high-contrast mode is enabled, all glass effects must be automatically disabled to prioritize functional accessibility.
97+
- **User controls and preferences:** Because some users might experience legibility issues in glass mode, any product utilizing glass must also let users swap to default contrast or high contrast via a theme switcher or preferences menu. Products should also respect the OS-level `prefers-reduced-transparency` media query, disabling glass or replacing it with a solid high-opacity background to accommodate users appropriately.
98+
99+
## Glass design tokens
100+
101+
The following tokens are used together to create the glass effect.
102+
103+
| Token | Value | Usage |
104+
| --- | --- | --- |
105+
| `--pf-t--global--background--color--glass--primary--default` | Light mode value: #FFFFFF (50% opacity) <br /> Dark mode value: #292929 (50% opacity) | Base fill for glass containers. |
106+
| `--pf-t--global--background--filter--glass--default` | Light mode value: 16% blur <br /> Dark mode value: 16% blur | Amount of blur applied to an element. |
107+
| `--pf-t--global--border--color--glass--default` | `--pf-t--global--border--color--alt` | Boundary highlight for glass surfaces. |
108+
| `--pf-t--global--border--radius--glass--default` | `--pf-t--global--border--radius--medium` | Rounded border for glass elements. |
109+
| `--pf-t--global--box-shadow--glass--default` | `--pf-t--global--box-shadow--md` | Shadow that signifies elevation. |
110+
111+
**Note:** `--pf-t--global--background--color--sticky--default` is not a glass-specific token, but it is relevant in glass contexts by providing a solid background for non-glass elements (like sticky headers) that sit directly on top of glass content.
112+
113+
## Best practices
114+
115+
To ensure a successful implementation, follow these best practices:
116+
- Ensure all text meets a 4.5:1 (AA) contrast ratio.
117+
- Ensure that high contrast mode overrides any use of glass to maintain accessibility requirements.
118+
- Always verify glass components against both light and dark background variations to catch contrast failures early.

packages/documentation-site/patternfly-docs/content/foundations-and-styles/styles/theming/high-contrast-handbook.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ source: high-contrast-handbook
66

77
# High contrast mode developer handbook
88

9+
High contrast mode increases the contrast of PatternFly components to support users with low vision or other visual impairments for whom higher contrast is a necessity. Our standard light and dark modes meet WCAG AA contrast ratios (4.5:1 for text), but high contrast mode goes further, targeting WCAG AAA text contrast ratios of 7:1. It also raises non-text element contrast (interactive elements and boundaries) to 4.5:1, and applies global border rules that define clear boundaries in place of shadows and subtle background fills, which can disappear in high contrast environments.
10+
11+
High contrast mode works across both the Default and Project Felt themes, in light and dark color schemes.
12+
913
## High contrast mode vs. forced colors mode
1014

1115
Our high contrast mode increases the contrast of PatternFly components, often introducing additional borders to distinguish between elements, states, and interactions that otherwise rely on subtle background colors. High contrast mode is enabled by applying styles that are meant to target the [`prefers-contrast: more`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-contrast) media query, which is the mode triggered on MacOS via **System Settings** > **Accessibility** > **Display** > **Increase contrast**.
1216

13-
This is different from [`forced-colors: active`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors), which is a more aggressive contrast mode where the browser enforces a limited, user-chosen color palette on a webpage, often by replacing author-defined colors with CSS system colors and removing styles like background colors and box shadows. Common triggers for forced colors mode are enabling Windows High Contrast Mode and Firefox High Contrast Mode. As outlined in [“Automatic high contrast”](#automatic-high-contrast), we recommend applying high contrast mode when `forced-colors: active` is `true`.
17+
This is different from [`forced-colors: active`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors), which is a more aggressive contrast mode where the browser enforces a limited, user-chosen color palette on a webpage, often by replacing author-defined colors with CSS system colors and removing styles like background colors and box shadows. Common triggers for forced colors mode are enabling Windows High Contrast Mode and Firefox High Contrast Mode. As outlined in [“Automatic high contrast”](#automatic-high-contrast), we recommend applying high contrast mode when the value of the `forced-colors` media query is `active`.
1418

1519
## Enabling high contrast mode
1620

@@ -51,6 +55,10 @@ We also added the following tokens for plain actions (actions with a transparent
5155
| `--pf-t--global--border--width--action--plain--hover` | 0px | `--pf-t--global--border--width--100` <br /><br/>Value: 1px |
5256
| `--pf-t--global--border--width--action--plain--clicked` | 0px | `--pf-t--global--border--width--200` <br /><br/>Value: 2px |
5357

58+
## High contrast and glass mode
59+
60+
To ensure functional accessibility always takes priority when users need it, high contrast mode and glass mode are mutually exclusive. When high contrast mode is enabled manually or via the OS-level `prefers-reduced-transparency` media query, all glass mode effects are automatically disabled.
61+
5462
## Best practices
5563

5664
In addition to the [general theming best practices](/foundations-and-styles/theming#best-practices), ensure that you adhere to the following guidelines when working in high contrast mode.
116 KB
Loading
91.8 KB
Loading

0 commit comments

Comments
 (0)