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

Feat/brand colors figma variables #698

Closed
wants to merge 6 commits into from

Conversation

garrettbear
Copy link
Contributor

@garrettbear garrettbear commented May 22, 2024

Description

Update to start using figma color variables for brandColor, lightTheme, and darkTheme. This involves a new json architect from Figma.

This update does include some breaking changes

  • Network Colors Removed
  • Colors previously noted as Deprecated have officially been removed
  • Changes to some color shades (detailed notes will be found in migration doc)

Related issues

Fixes: #660 #660

Manual testing steps

  1. Run Storybook
  2. View Brand Colors
  3. View Light Theme
  4. View Dark Theme

Screenshots/Recordings

Before

before720.mov

After

Screen.Recording.2024-05-22.at.4.35.03.PM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@metamaskbot
Copy link
Collaborator

Builds ready [1014602]

Storybook: Storybook

@garrettbear garrettbear added documentation Improvements or additions to documentation color Tokens related to color team-design-system All issues relating to design system labels May 23, 2024
@garrettbear
Copy link
Contributor Author

@brianacnguyen @georgewrmarshall I noticed we need to add white and black to brand colors for css

@garrettbear garrettbear marked this pull request as ready for review May 23, 2024 00:11
@garrettbear garrettbear requested a review from a team as a code owner May 23, 2024 00:11
@metamaskbot
Copy link
Collaborator

Builds ready [5d8134b]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [8a39830]

Storybook: Storybook

Copy link
Collaborator

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Looking really good! Can we ensure that all Added, Changed and Removed CSS and JS tokens are listed in the migration docs. Also looks like there is an issue with displaying Figma tokens

Screenshot 2024-05-23 at 12 29 56 PM Screenshot 2024-05-23 at 12 30 02 PM

Something like

Added

CSS

--brand-colors-grey-grey000
--brand-colors-grey-grey025
--brand-colors-grey-grey050
--brand-colors-grey-grey1000
--brand-colors-blue-blue025
--brand-colors-blue-blue050
// etc

JS

brandColor.grey000
brandColor.grey025
brandColor.grey050
// 

Removed

CSS

--brand-colors-grey-grey030
--brand-colors-grey-grey040
--brand-colors-grey-grey750
--brand-colors-blue-blue000
--brand-colors-green-green000
--brand-colors-red-red000
// etc

JS

brandColor.grey030
brandColor.grey040
brandColor.grey750
brandColor.blue000
brandColor.green000
brandColor.red000
// etc

lightTheme.colors.overlay.inverse
lightTheme.colors.primary.shadow
lightTheme.colors.primary.disabled
lightTheme.colors.secondary
lightTheme.colors.error.shadow
// etc

Changed

CSS

--brand-colors-white-white000 to --brand-colors-white
--brand-colors-black-black000 to --brand-colors-black

JS

brandColor.white000 to brandColor.white
brandColor.black000 to `brandColor.black

MIGRATION.md Outdated Show resolved Hide resolved
automation-scripts/brandColor.js Show resolved Hide resolved
MIGRATION.md Show resolved Hide resolved
automation-scripts/themeColors.js Show resolved Hide resolved
@@ -51,7 +51,7 @@ export const CSS: Story = {
},
};

export const JS: Story = {
export const JS = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this change necessary? The other Stories are typed can we either remove it from all stories or add it here?

Suggested change
export const JS = {
export const JS: Story = {

src/css/brand-colors.css Show resolved Hide resolved
Comment on lines -33 to -37
--color-secondary-default: var(--brand-colors-orange-orange400);
--color-secondary-alternative: var(--brand-colors-orange-orange300);
--color-secondary-muted: #f8883b26;
--color-secondary-inverse: var(--brand-colors-grey-grey900);
--color-secondary-disabled: #f8883b80;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same for all these

Comment on lines -34 to -38
--color-secondary-default: var(--brand-colors-orange-orange500);
--color-secondary-alternative: var(--brand-colors-orange-orange600);
--color-secondary-muted: #f66a0a19;
--color-secondary-inverse: var(--brand-colors-white-white000);
--color-secondary-disabled: #f66a0a80;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add to migration docs

Comment on lines 4 to 6

:root {
/* typography */
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Can we revert these changes to keep code changes down?

Comment on lines +7 to +26
Object.entries(brandColor).forEach(([key, value]) => {
const colorFamily = key.replace(/\d+.*$/u, ''); // Extracts 'grey' from 'grey000'
const shadeMatch = key.match(/\d+/gu); // Extracts ['000'] from 'grey000'
// if no numeric key is found, skip the test
if (!shadeMatch?.[0]) {
describe(`${colorFamily.toUpperCase()} `, () => {
it(`js tokens for ${key} matches figma brandColor ${colorFamily}`, () => {
const tokenValue = designTokens[colorFamily]?.value ?? '';
expect(value.toLowerCase()).toStrictEqual(tokenValue.toLowerCase());
});
});
return;
}
const shadeKey = shadeMatch[0]; // Ensures there's a valid shade key

describe(`${colorFamily.toUpperCase()} ${shadeKey}`, () => {
it(`js tokens for ${key} matches figma brandColor ${colorFamily}${shadeKey}`, () => {
const tokenValue = designTokens[colorFamily][shadeKey]?.value ?? '';
expect(value.toLowerCase()).toStrictEqual(tokenValue.toLowerCase());
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really nice!

Screenshot 2024-05-23 at 12 25 42 PM

@georgewrmarshall georgewrmarshall mentioned this pull request May 23, 2024
13 tasks
@metamaskbot
Copy link
Collaborator

Builds ready [b87d5b2]

Storybook: Storybook

MIGRATION.md Outdated
Comment on lines 201 to 120
- Grey updates
- grey000 added
- grey025 added
- grey050 added
- grey030 removed
- grey040 removed
- grey750 removed
- grey1000 added

- Blue updates
- blue000 removed
- blue025 added
- blue050 added
- blue400-15 added
- blue500-10 added

- Green updates
- green000 removed
- green025 added
- green050 added
- green400-15 added
- green500-10 added

- Red updates
- red000 removed
- red025 added
- red050 added
- red400-15 added
- red500-10 added

- Yellow updates
- yellow000 removed
- yellow025 added
- yellow050 added
- yellow100-15 added
- yellow400-15 added
- yellow500-10 added
- yellow700 added
- yellow800 added
- yellow900 added

- Orange updates
- orange000 removed
- orange025 added
- orange050 added

- Violet removed

- Purple added

- Lime added

- White and black updates
- white000 renamed to white
- white010 removed
- black000 renamed to black

### Brand Colors Brand Evolution

- Blue updates
- blue300-15 added
- blue400-15 removed

- Green updates
- green300-15 added
- green400-15 removed

- Red updates
- red300-15 added
- red400-15 removed

### Themed Colors

- overlay-inverse removed
- primary-shadow removed
- primary-disabled removed
- secondary colors removed
- error-shadow removed
- error-disabled removed
- warning-alternative removed
- warning-disabled removed
- success-alternative removed
- success-disabled removed
- info-alternative removed
- info-disabled removed
- network colors removed
- shadow-primary added
- shadow-error added
- button colors removed
Copy link
Collaborator

Choose a reason for hiding this comment

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

These can be removed once they have be cross referenced with the JS and CSS above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@georgewrmarshall you'll need to be a little more specific. I'm not completely understand how you want this written out

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've listed the specific JS and CSS tokens that engineers should check for. For example, what does "button colors" mean? What do "network colors" refer to? Without these specifics, it's difficult for engineers to understand what to look for when identifying removed design token code. This list should also be used to check for any removed CSS variables.

@metamaskbot
Copy link
Collaborator

Builds ready [3af0066]

Storybook: Storybook

@garrettbear garrettbear force-pushed the feat/brand-colors-figma-variables branch from 3af0066 to 102e30c Compare May 23, 2024 23:34
@metamaskbot
Copy link
Collaborator

Builds ready [102e30c]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [d9533a5]

Storybook: Storybook

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file does still currently have some lint errors/warnings but is operational

@metamaskbot
Copy link
Collaborator

Builds ready [228c1df]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [f1e3d70]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [d3b0a10]

Storybook: Storybook

CHANGELOG.md Outdated
@@ -260,7 +290,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release.

[Unreleased]: https://github.com/MetaMask/design-tokens/compare/v2.1.1...HEAD
[Unreleased]: https://github.com/MetaMask/design-tokens/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/MetaMask/design-tokens/compare/v2.1.1...v3.0.0
[2.1.1]: https://github.com/MetaMask/design-tokens/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/MetaMask/design-tokens/compare/v2.0.3...v2.1.0
[2.0.3]: https://github.com/MetaMask/design-tokens/compare/v2.0.2...v2.0.3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Revert these changes

@metamaskbot
Copy link
Collaborator

Builds ready [04e54c7]

Storybook: Storybook

vite.config.mjs Outdated
},
server: {
open: '/index.html',
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this file

@metamaskbot
Copy link
Collaborator

Builds ready [e89d993]

Storybook: Storybook

@georgewrmarshall georgewrmarshall force-pushed the feat/brand-colors-figma-variables branch from e89d993 to f3784f7 Compare May 29, 2024 22:06
@metamaskbot
Copy link
Collaborator

Builds ready [f3784f7]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [d562c11]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [6471cf4]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [0dd8193]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [62635f9]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [65789a7]

Storybook: Storybook

@georgewrmarshall
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color Tokens related to color documentation Improvements or additions to documentation team-design-system All issues relating to design system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update CSS-in-JS with Brand Color Tokens - Light Theme
3 participants