-
Notifications
You must be signed in to change notification settings - Fork 148
docs(theming): Adds details around new theme and glass mode. #4983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
eccd63b
aad3e20
1f44f70
deb9a60
4475558
2735c8a
10a4a6d
0d784aa
9d832c9
9310dbb
f8ed613
3de1c3e
611309b
e9e54a4
31024c1
ae13969
f2d9935
6c182c9
54580e6
a5fa42f
2b992cb
6291449
f4187c9
8b6ecc3
efa0716
2e37187
f9b843f
2c253c4
05bb6a2
4fb0c6b
9ac99f5
d2445f5
587999f
c346970
b5e7c50
b4a4cc7
079fe6d
5b5c313
be8c842
91e5cae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | |||||||||||||||||||||||
| --- | |||||||||||||||||||||||
| id: Theming | |||||||||||||||||||||||
| section: foundations-and-styles | |||||||||||||||||||||||
| source: glass-mode-handbook | |||||||||||||||||||||||
| --- | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| # Glass mode developer handbook | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ## What is glass mode? | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| Glass mode is a contrast mode option that's enabled in our Project Felt theme by default and can be manually enabled in our Default theme. 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. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| When turned on, glass applies to the following components, including their uses within our extensions: | |||||||||||||||||||||||
| - Login page | |||||||||||||||||||||||
| - Masthead | |||||||||||||||||||||||
| - Navigation | |||||||||||||||||||||||
| - Page | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| Additionally, glass can be manually enabled on the following components, via the `isGlass` prop: | |||||||||||||||||||||||
| - Card | |||||||||||||||||||||||
| - Drawer | |||||||||||||||||||||||
| - Panel | |||||||||||||||||||||||
|
edonehoo marked this conversation as resolved.
|
|||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ### Background images | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| 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. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| Background images should be selected for each Red Hat product in collaboration with the Brand team. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| Text must never be placed directly on a background image—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. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ### Opacity | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| The default opacity values used in our components have been tested for accessibility, legibility, and visual appeal. | |||||||||||||||||||||||
| - Project Felt light typically utilizes a 40% opacity to maintain AAA contrast for standard text. | |||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glass surfaces like page, masthead, navigation, etc use 50% opacity in both light and dark mode. They also have the background blur effect applied.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated this section to be this: "Glass surfaces (page, masthead, navigation, and similar components) use 50% opacity in both light and dark mode, with a background blur effect applied." I feel like this statement conflicts with what I put in this token table - is this not accurate? I tried pulling these values from the unified theme file, but might have not done so correctly
|
|||||||||||||||||||||||
| - Project Felt dark utilizes a 60% opacity to provide better reliability for the dark color scheme. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| If a product team chooses to override these token values, they are responsible for conducting their own accessibility evaluation to ensure WCAG compliance. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ## Enabling glass mode | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| Glass mode is designed to work across light and dark color schemes and is enabled by default in our Project Felt theme. To manually enable glass in our Default theme, add the class `.pf-v6-theme-glass` to your application’s `<html>` tag. When implementing glass with our Default theme, it's important to ensure that glass does not harm the overall accessibility or usability of your product. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ### Technical constraints | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| There are a few technical constraints to abide by when using glass in your product. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - **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. | |||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth noting that we have introduced opaque styles for any items that are floating directly on top of glass elements (i.e. sticky sections, menus, popovers, overlay drawers, etc.) |
|||||||||||||||||||||||
| - **High contrast precedence:** If high-contrast mode is enabled, all glass effects must be automatically disabled to prioritize functional accessibility. | |||||||||||||||||||||||
| - **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. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ## Glass design tokens | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| The following tokens are used together to create the glass effect. | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| | Token | Value (in Project Felt theme) | Usage | | |||||||||||||||||||||||
| | --- | --- | --- | | |||||||||||||||||||||||
| | `--pf-t--global--background--color--glass--primary--default` | Light mode value: #FFFFFF (60% opacity) <br /> Dark mode value: #292929 at 50% opacity | Base fill for glass containers. | | |||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 50% in both themes. |
|||||||||||||||||||||||
| | `--pf-t--global--background--filter--glass--default` | Light mode value: #C7C7C7 (25% opacity) <br /> Dark mode value: #C7C7C7 (15% opacity) | Overlay tint used to enhance blur visibility. | | |||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we dropped this to a lower 16% blur in both themes. also this is not an overlay tint, its the actual blur value! |
|||||||||||||||||||||||
| | `--pf-t--global--border--color--glass--default` | Light mode value: #FFFFFF (60% opacity) <br /> Dark mode value: #292929 (50% opacity) | Boundary highlight for glass surfaces. | | |||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this references our border--color--alt token in glass mode (which maps to primary bkg color) |
|||||||||||||||||||||||
| | `--pf-t--global--border--radius--glass--default` | #D6D6D6 with 16px radius | Default rounded border for glass element. | | |||||||||||||||||||||||
| | `--pf-t--global--background--color--sticky--default` | Light mode value: #FFFFFF (100% opacity) <br /> Dark mode value: #292929 (100% opacity) | Solid background for sticky elements, like headers. | | |||||||||||||||||||||||
| | `--pf-t--global--box-shadow--medium` | #292929 (15% opacity) | Shadow that signifies elevation. | | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| ## Best practices | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| To ensure a successful implementation, follow these best practices: | |||||||||||||||||||||||
| - Ensure all text meets a 4.5:1 (AA) contrast ratio. | |||||||||||||||||||||||
| - Ensure that high contrast mode overrides any use of glass to maintain accessibility requirements. | |||||||||||||||||||||||
| - Always verify glass components against both light and dark background variations to catch contrast failures early. | |||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.