Skip to content
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

fix(theming)!: remove background.primary color variable #1938

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

ze-flo
Copy link
Contributor

@ze-flo ze-flo commented Sep 30, 2024

Description

Following @lucijanblagonic's Figma comment, background.primary isn't relevant to Garden consumers and should be removed.

Details

  • Removes background.primary from Theme
  • Replaces instance of background.primary with background.primaryEmphasis

Checklist

  • 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • 🌐 demo is up-to-date (npm start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • ⚫ renders as expected in dark mode
  • ~~:metal: renders as expected with Bedrock CSS (?bedrock)~
  • 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • ♿ tested for WCAG 2.1 AA accessibility compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

@ze-flo ze-flo requested a review from a team as a code owner September 30, 2024 20:22
@ze-flo ze-flo changed the title chore(theming): remove unused background.primary color variable fix(theming)!: remove background.primary color variable Sep 30, 2024
@coveralls
Copy link

coveralls commented Sep 30, 2024

Coverage Status

coverage: 95.904%. remained the same
when pulling 6036eaa on ze-flo/remove-background-primary
into 8c383a0 on main.

@@ -64,7 +64,9 @@ export const MenuStory: StoryFn = ({ isCompact }) => {
status={item.avatarProps.status}
badge={item.avatarProps.badge}
surfaceColor={
highlightedValue === item.value ? 'background.primary' : 'background.raised'
highlightedValue === item.value
? 'background.primaryEmphasis'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting for the PR to deploy, but I don't think this is what we want to demonstrate with this pattern. The idea is to get the avatar's surface to match the active menu item as close as possible. So, it should be something like getColor({ theme, hue: 'primaryHue', light: { shade: 100}, dark: { shade: 900} }) to correspond with the previous variable values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe getColor({ theme, variable: 'background.primaryEmphasis', transparency: 100 }) is a more successful match 🤷

Copy link
Contributor Author

@ze-flo ze-flo Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe getColor({ theme, variable: 'background.primaryEmphasis', transparency: 100 }) is a more successful match 🤷

getColor will throw because the output of the ☝️ is rgba() and it's treated as a color variable ($surfaceColor.includes('.')). We would have to refine the logic everywhere this comes up.

ReferenceError: Error: color variable 'rgba(31,115,183,0.08)' is not defined

Also, with the way Avatar is built, the transparent surfaceColor would lay on top of the background color. That wouldn't result in the right color.

@@ -29,7 +29,7 @@ export interface IAvatarProps extends HTMLAttributes<HTMLElement> {
/**
* Provides surface color for an avatar placed on a non-default background.
* Accepts a [color variable](/components/theme-object#colors) key (i.e.
* `background.primary`) to render based on light/dark mode, or any hex value.
* `background.primaryEmphasis`) to render based on light/dark mode, or any hex value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `background.primaryEmphasis`) to render based on light/dark mode, or any hex value.
* `background.emphasis`) to render based on light/dark mode, or any hex value.

[nit] because we don't want to suggest that primaryEmphasis should be used for anything other than primary interactive elements.

@ze-flo ze-flo merged commit 311aac3 into main Sep 30, 2024
8 checks passed
@ze-flo ze-flo deleted the ze-flo/remove-background-primary branch September 30, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants