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

Common color keys #36

Open
BorisZubchenko opened this issue Oct 12, 2023 · 0 comments
Open

Common color keys #36

BorisZubchenko opened this issue Oct 12, 2023 · 0 comments

Comments

@BorisZubchenko
Copy link

BorisZubchenko commented Oct 12, 2023

Not:

export const gray = {
  gray1: "#fcfcfc",
  gray2: "#f9f9f9",
  gray3: "#f0f0f0",
  // etc.
};

But:

export const gray = {
  1: "#fcfcfc",
  2: "#f9f9f9",
  3: "#f0f0f0",
  // etc.
};

This gives the ability to swap colors dynamically:

function createTheme(palette: Palette) {
  return {
    background: palette[1],
    foreground: palette[12],
    // etc.
  }
}

const blueTheme = createTheme(colors.blue)
const redTheme = createTheme(colors.red)

For example, Tailwind does the same.

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

No branches or pull requests

1 participant