feat(themes): adds tokens for glass and redhat themes#8062
feat(themes): adds tokens for glass and redhat themes#8062mcoker merged 4 commits intopatternfly:mainfrom
Conversation
WalkthroughAdds new theme token modules (glass and multiple Red Hat variants) and corresponding mixin-based token overrides; expands base and dark token sets with glass, loading-skeleton, and extended brand/accent/subtle tokens. New token files are imported and exposed via theme variants. Changes
Sequence Diagram(s)(omitted — changes are token additions and mixin mappings without multi-component runtime control flow) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview: https://pf-pr-8062.surge.sh A11y report: https://pf-pr-8062-a11y.surge.sh |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/patternfly/base/patternfly-variables.scss`:
- Around line 8-14: Remove the trailing whitespace after the alias on the
existing import (the `@use "./tokens/tokens-redhat" as redhat` line) and add an
import for the missing glass dark tokens file by adding a `@use` for
`tokens-glass-dark` (alias it consistently, e.g., `glass-dark`) next to the
other token imports so the standalone non-redhat glass dark theme is available
alongside `tokens-glass` and `tokens-redhat-glass-dark`.
In `@src/patternfly/base/tokens/tokens-default.scss`:
- Line 115: The token --pf-t--global--text-decoration--offset--hover in
tokens-default.scss is unitless (5) and must be a valid CSS length; change its
value to the same pattern used in tokens-local.scss (for example:
calc(var(--pf-t--global--spacer--xs) + 1px)) so consumers like button.scss
receive a proper length and remain consistent with the default offset token and
normalize.scss usage.
In `@src/patternfly/base/tokens/tokens-redhat-highcontrast-dark.scss`:
- Line 5: Update the misleading header comment "// Only tokens that differ from
base theme (40 tokens)" to reflect the actual number of token definitions
present in src/patternfly/base/tokens/tokens-redhat-highcontrast-dark.scss
(currently 41), or fix the token-generation script so it emits the correct
count; locate the header comment in that SCSS file and either increment the
numeric value to 41 or adjust the generator logic that produces the count so the
comment matches the actual number of token definitions.
| --pf-t--global--spacer--800: 5rem; | ||
| --pf-t--global--text-decoration--line--100: none; | ||
| --pf-t--global--text-decoration--line--200: underline; | ||
| --pf-t--global--text-decoration--offset--hover: 5; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
rg -n --type=scss "text-decoration--offset--hover" -C3Repository: patternfly/patternfly
Length of output: 186
🏁 Script executed:
rg -n --type=scss "text-decoration--offset" -C2Repository: patternfly/patternfly
Length of output: 93
🏁 Script executed:
rg -n --type=scss "text-decoration" -A2 -B2 | head -100Repository: patternfly/patternfly
Length of output: 93
🏁 Script executed:
rg -n "text-decoration--offset--hover" -C3Repository: patternfly/patternfly
Length of output: 3435
🏁 Script executed:
rg -n "text-decoration--offset" -C2Repository: patternfly/patternfly
Length of output: 5108
🏁 Script executed:
# Check the file directly to see context around line 115
fd "tokens-default.scss" -x wc -l {}Repository: patternfly/patternfly
Length of output: 117
🏁 Script executed:
# Read the relevant section of the file
fd "tokens-default.scss" -x cat -n {} | sed -n '110,130p'Repository: patternfly/patternfly
Length of output: 1304
🏁 Script executed:
# Also check line 596 with default offset
fd "tokens-default.scss" -x cat -n {} | sed -n '590,605p'Repository: patternfly/patternfly
Length of output: 1698
Fix unitless value for text-decoration offset hover token.
The --pf-t--global--text-decoration--offset--hover: 5; token is unitless and inconsistent with the default offset token (var(--pf-t--global--spacer--xs)) and the tokens-local override (calc(var(--pf-t--global--spacer--xs) + 1px)). Although the normalize.scss usage wraps it in max(var(...), 0.33em) providing a fallback, the bare 5 value is invalid when consumed directly in button.scss and other components. This should match the pattern used in tokens-local.scss with proper length units.
🤖 Prompt for AI Agents
In `@src/patternfly/base/tokens/tokens-default.scss` at line 115, The token
--pf-t--global--text-decoration--offset--hover in tokens-default.scss is
unitless (5) and must be a valid CSS length; change its value to the same
pattern used in tokens-local.scss (for example:
calc(var(--pf-t--global--spacer--xs) + 1px)) so consumers like button.scss
receive a proper length and remain consistent with the default offset token and
normalize.scss usage.
lboehling
left a comment
There was a problem hiding this comment.
this all looks right to me! so easy to see the differences with the shortened list!
I did just add in a new token for global--background--color--floating & added "--primary" to the end of the current glass token ((but i likely added those in after you pulled these))
mcoker
left a comment
There was a problem hiding this comment.
Everyting LGTM. On the new glass token names, just some feedback. I think we should tweak them before trying to use them. Do we want to do that in this PR or as a follow up?
--pf-t--global--background--color--glass--floating: rgba(255, 255, 255, 0.8000);
--pf-t--global--background--color--glass--primary: rgba(255, 255, 255, 0.8000);
--pf-t--global--background--filter--glass: 12.5;
--pf-t--global--background--opacity--glass: 80;Thoughts:
- Since the background colors have the opacity built in,
--pf-t--global--background--opacity--glasswon't do anything. --filter--glass: 12.5- the token is named "filter" but the value is specific to the "blur" filter. This is fine, but to future proof it, I'd separate those concepts somehow so that we could add extra filters (likesaturate()orcontrast()oropacity()). It would also be great to get this aspxin the token (12.5px)--opacity--glass: 80- token looks good but would be great to get with%(80%).- Would it make sense to have a unique opacity and/or blur for floating vs primary?
My suggestion:
- Make
--pf-t--global--background--color--glass--floatingand--pf-t--global--background--color--glass--primary"figma only" vars, so we won't import them. - We will add
--pf-t--global--background--color--glass--floatingand--pf-t--global--background--color--glass--primaryas local/custom vars, and we'll set the color/opacity in them. So both figma and core will use the same var name for the actual var that gets used as the glass background color value. - For both the primary and floating background colors, add a new var in figma that holds just the color. This would be for core only, for us to combine with the opacity var to construct the color function. We can name them
--pf-t--global--background--color--glass--floating--baseor something (with--baseat the end). Not sure if we have an existing naming pattern that would work there? The value can be an existing token, too, instead of anrgb(), if a token is more ideal there. - Change
--filter--glassto--filter--blur--glass. Then if we add acontrast()filter or something, we can use--filter--contrast--glass. Also addpxto the value so it's12.5px. I thought about using--blur--glass, but if we added an extra opacity filter, using--blur--glassas the filter name would imply we would add--opacity--glassfor the opacity filter, but--opacity--glassis already in use, so we would have a name conflict. - Add
%to--opacity--glassso it's80%
So the token export would look like
// from figma
--pf-t--global--background--color--glass--floating--base: var(--pf-t--color--white);
--pf-t--global--background--color--glass--primary--base: var(--pf-t--color--white);
--pf-t--global--background--filter--blur--glass: 12.5px;
--pf-t--global--background--opacity--glass: 80%;
// core custom/local styles
--pf-t--global--background--color--glass--floating: color-mix(in srgb, var(-pf-t--global--background--color--glass--floating--base) var(--pf-t--global--background--opacity--glass), transparent);
--pf-t--global--background--color--glass--primary: color-mix(in srgb, var(-pf-t--global--background--color--glass--primary--base) var(--pf-t--global--background--opacity--glass), transparent);On 2 & 3 above, we could also do it like this:
// from figma - same names as the figma only tokens
--pf-t--global--background--color--glass--floating: var(--pf-t--color--white);
--pf-t--global--background--color--glass--primary: var(--pf-t--color--white);
// core custom/local styles
--pf-t--global--background--color--glass--floating--default: color-mix(in srgb, var(-pf-t--global--background--color--glass--floating) var(--pf-t--global--background--opacity--glass), transparent);
--pf-t--global--background--color--glass--primary--default: color-mix(in srgb, var(-pf-t--global--background--color--glass--primary) var(--pf-t--global--background--opacity--glass), transparent);
mcoker
left a comment
There was a problem hiding this comment.
LGTM! Will follow up on the issues I brought up;.
|
🎉 This PR is included in version 6.5.0-prerelease.35 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #8061
Adds token files for glass and redhat (unified) themes.
Note: The new tokens files are only the changed tokens compared to the default (existing patternfly theme) set of tokens.
Backstop report shows differences in
--pf-t--global--color--disabled--300)Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.