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

chore: change the color palette #48

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

marcosh-ramos
Copy link
Collaborator

@marcosh-ramos marcosh-ramos commented Jan 17, 2025

closes #35
closes #45

What?

With this task we are changing the colors to use the new variants introduced by storyblok.

Why?

How to test? (optional)

Open the preview and check the palette of colors and how it looks in the components.

Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 2:28pm

@marcosh-ramos marcosh-ramos changed the title Change the color palette chore: change the color palette Jan 17, 2025
@@ -28,7 +28,7 @@ export const Shadows = () => {
Display
</Typography>
</Grid>
{Object.keys(theme.shadows).map((index) => (
{Object.keys(theme.shadows.slice(0, 5)).map((index) => (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

did this because for the design system we only have 4 variants of shadow

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marcosh-ramos, this will cause a breaking change though. The MUI theme type accepts 25 variants, so we must adhere to it.

At a later point, we could create a custom theme, but for now we must adhere to the type.

Perhaps we can make every 5 shadows the same?

  • 0-4 -> 0
  • 5-9 -> 1
  • etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that would be strange have the shadows from 0 to 4 mapping to none, at least was not was I would expect if I use shadows[1]

Copy link
Collaborator Author

@marcosh-ramos marcosh-ramos Jan 24, 2025

Choose a reason for hiding this comment

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

I went back to what was before. for me would be worst to map like this because people that now use the shadows from 1 to 4 would lose it with this update.

changes:
e66a71c#diff-eaaeb6908dd041479365a278ba68513d6ffb3512501d44999c6e1685cfa89cb1L31
e66a71c#diff-f2727474dc5684e74bd35e134abe55e2a53454471a4f806c72942be9b1b0b458R56-R67

Copy link
Collaborator

@SiloGecho97 SiloGecho97 left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Collaborator

@johannes-lindgren johannes-lindgren left a comment

Choose a reason for hiding this comment

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

@marcosh-ramos Nice! I found some breaking changes though.

We'd need a more detailed better description, so that it's clear what we are updating. We will need to communicate all of this in detail in the release notes anyways.

@@ -28,7 +28,7 @@ export const Shadows = () => {
Display
</Typography>
</Grid>
{Object.keys(theme.shadows).map((index) => (
{Object.keys(theme.shadows.slice(0, 5)).map((index) => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

@marcosh-ramos, this will cause a breaking change though. The MUI theme type accepts 25 variants, so we must adhere to it.

At a later point, we could create a custom theme, but for now we must adhere to the type.

Perhaps we can make every 5 shadows the same?

  • 0-4 -> 0
  • 5-9 -> 1
  • etc

//Box-shadow
export const box_shadow_default = `0 2px 17px 3px rgba(34, 42, 69, 0.07)`
//Transition
export const base_transition_duration = '0.1s'
export const base_transition_easing = 'ease-in-out'
export const base_transition = `all ${base_transition_duration} ${base_transition_easing}`
export const base_border_radius = 5
export const base_border_radius = 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a bit high. It would mean mean that the radius cannot go below 8. Is this what we want?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is what we use as the default in storyfront

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marcosh-ramos maybe so, but it means we cannot really go below it:

image

Copy link
Collaborator Author

@marcosh-ramos marcosh-ramos Jan 24, 2025

Choose a reason for hiding this comment

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

"...but it means we cannot really go below it", I din't understand why, so in this case with what we have now we can't go below 5? Anyway, I went back to what was before (5), since this PR was to change the colors.

change: e66a71c#diff-cc30f115439d4b426941a0f00ad2d2cd110eb3602cf16f906a68460407a389c4L19

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would be a breaking change. We cannot change the variable names

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why a breaking change? is somebody importing directly from this file?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marcosh-ramos if someone imports it from

import { color_primary } from '@storyblok/mui'

This change would break their app

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines 2 to 13
export const sb_primary_50 = '#d5fcfa'
export const sb_primary_100 = '#b5ece9'
export const sb_primary_200 = '#9ae6e2'
export const sb_primary_300 = '#72dfda'
export const sb_primary_400 = '#37dcd3'
export const sb_primary_500 = '#04c8c0'
export const sb_primary_600 = '#00b3b0'
export const sb_primary_700 = '#05807f'
export const sb_primary_800 = '#0a6465'
export const sb_primary_900 = '#0a6465'
export const sb_primary_950 = '#003033'
export const sb_primary = sb_primary_700
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we keep this, we could put it in an object dictionary, like the grey.

const primary = {
  50: ...,
  100: ...,
}

etc

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I am not sure we need the full gradient. It kind of defeats the purpose of designs tokens. Doesn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines 65 to 69
'0px 4px 8px 0px rgba(27, 36, 63, 0.08)',
'0px 8px 24px 0px rgba(27, 36, 63, 0.08)',
'0px 16px 32px 0px rgba(27, 36, 63, 0.08)',
'0px 16px 48px 0px rgba(27, 36, 63, 0.08)',
...Array(20).fill('none'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

See my suggestion above to make every 5 shadows the same, rather than making shadows[20-24] none

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

main: color_primary,
contrastText: white,
main: sb_primary,
contrastText: sb_neutral_white,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the design token's definition of "neutral white" is it for text or surfaces? "neutral black" doesn't seem to be intended for text, for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there there's no definition, it's only a primitive colors for black and white

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then we could just hard-code it: #ffffff. If the design token doesn't have a semantic meaning, what is the point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

src/theme/design-tokens/palette.ts Outdated Show resolved Hide resolved
Comment on lines 127 to 138
grey: {
'50': '#f7f8f9',
'100': '#ECF0FF',
'200': '#E2E6F5',
'300': '#D1D5E4',
'400': '#ADB1C0',
'500': '#8d919f',
'600': '#656976',
'700': '#525662',
'800': '#343743',
'900': '#141822',
'50': sb_base_50,
'100': sb_base_100,
'200': sb_base_200,
'300': sb_base_300,
'400': sb_base_400,
'500': sb_base_500,
'600': sb_base_600,
'700': sb_base_700,
'800': sb_base_800,
'900': sb_base_900,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could perhaps move this whole object to design-tokens/palette

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's possible, just a point, in design tokens there's on more color (950) that we could not pass here since the mui only maps until 900

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marcosh-ramos, the object could still contain it. For grey, we could create a new object where we just remove the 950

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

src/theme/design-tokens/palette.ts Outdated Show resolved Hide resolved
},
},
'&:hover': {
backgroundColor: sb_secondary_50,
Copy link
Collaborator

Choose a reason for hiding this comment

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

For these properties, we should use ({ theme }) => to use the design token from the palette. At the time that I wrote this existing line, I did not know this was possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

- coming back with the old color variables
- coming back with the 5px to the base_border_radius
- coming back with the old shadows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update text.secondary Adjust primary color
3 participants