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: add new base palette colors & use them in pentaho+ theme #4188

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

zettca
Copy link
Member

@zettca zettca commented May 27, 2024

  • Adds new "base palette"/color matrix (we need to give this a proper name 😅) to the styles package
    • Available from theme.palette - values are not injected as CSS vars
  • Align the current tokens (positive, atmo<X>) with the new palette in the the Pentaho+ theme
  • Hoist utility tokens (backgroundColor/containerBackgroundHover) to the tokens declaration
  • Refactors & improvements

@github-actions github-actions bot temporarily deployed to uikit-app/pr-4188 May 27, 2024 18:04 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-docs/pr-4188 May 27, 2024 18:04 Destroyed
@zettca zettca marked this pull request as ready for review May 27, 2024 18:12
@zettca zettca requested a review from a team as a code owner May 27, 2024 18:12
@zettca zettca requested review from francisco-guilherme and HQFOX and removed request for a team May 27, 2024 18:12
@@ -135,12 +135,10 @@ const categorical = {
const common = {
...base,
...categorical,
// TODO: add "base palette" colors?
Copy link
Member Author

Choose a reason for hiding this comment

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

If we spread the "base palette" colors here, they'll be injected as CSS variables and available in theme.colors.*, but these tokens do not vary depending on theme.

  1. Should we inject the CSS vars?
  2. Should we make them available only on the "runtime" theme object (from useTheme)?
  3. Should we keep it as a separate static import?

1. seems wasteful, and if we don't want to promote the usage of the palette colors directly 3. might make the most sense

Copy link
Contributor

Choose a reason for hiding this comment

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

The "base palette" are the colors added to colosPalette.ts, right?

Doing only 2 means that users will only be able to use these colors inside a function component or hook (otherwise they'll need to "hack" their way into using them somewhere else). I'm not 100% comfortable with that.

We could do 3 but it seems a bit confusing to me (and to users) to import colors from two different places: theme and static imports.

I agree that 1 seems wasteful, and we would be polluting the stylesheets with unnecessary CSS vars. However, it makes sense to have access to these colors when using theme. Can't we do a mix of both inside the theme object? Some colors are CSS vars and other ones are static values? For example we have utils like spacing or alpha that are static.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we could optimize which colors are injected as CSS vars 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Tokens are available from theme.palette (alternative suggestions welcome)

packages/styles/src/tokens/colorsPalette.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@MEsteves22 MEsteves22 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@MEsteves22
Copy link
Contributor

MEsteves22 commented May 28, 2024

Some questions/things to think about:

  • pentahoPlus theme mapping: to review after DS provides a mapping of their own.
  • White labelling feature for the new palette not possible at the moment (the palette is static).
  • Some confusion (at leats on my side) about the themes: DS3/DS5 color tokens used inside the pentahoPlus theme. New palette tokens not used/available.

These are just some questions I had after reviewing the PR, but they are for the future. I know these were not in the scope of this PR 🙏

@zettca
Copy link
Member Author

zettca commented May 28, 2024

pentahoPlus theme mapping: to review after DS provides a mapping of their own.

Yes, this is just initial work 👍

White labelling feature for the new palette not possible at the moment (the palette is static).

You you mean light/dark themes? Users can/should be able to do that by overriding a few "semantic tokens" (which do don't have yet) - they shouldn't need a "full palette" of their own
For instance, MUI has a large palette of colors; but to create your own theme, you just need to override a few "semantic tokens" (eg primary, secondary, text, warning, etc.)

Some confusion (at leats on my side) about the themes: DS3/DS5 color tokens used inside the pentahoPlus theme. New palette tokens not used/available.

One more reason to now inject the "palette" tokens in theme.colors.* yet IMO 🤔 (besides not being recommended to use directly (as they're not themed))

@github-actions github-actions bot temporarily deployed to uikit-app/pr-4188 May 29, 2024 09:01 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-docs/pr-4188 May 29, 2024 09:01 Destroyed
@zettca zettca force-pushed the feat/colors branch 2 times, most recently from fd69e38 to 4b70093 Compare June 18, 2024 10:45
@github-actions github-actions bot temporarily deployed to uikit-app/pr-4188 June 18, 2024 10:49 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-docs/pr-4188 June 18, 2024 10:50 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-4188 June 18, 2024 14:27 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-docs/pr-4188 June 18, 2024 14:27 Destroyed
@MEsteves22 MEsteves22 merged commit 2f5bc50 into master Jun 19, 2024
15 of 17 checks passed
@MEsteves22 MEsteves22 deleted the feat/colors branch June 19, 2024 16:55
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.

4 participants