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

Create theme-unaware high-level tokens #2282

Open
rajsite opened this issue Jul 17, 2024 · 1 comment
Open

Create theme-unaware high-level tokens #2282

rajsite opened this issue Jul 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@rajsite
Copy link
Member

rajsite commented Jul 17, 2024

🙋 Feature Request

😯 Problem to Solve

We currently have:

  • theme-unaware base tokens such as $ni-nimble-base-black-85 that are static values defined as raw values
  • theme-aware high-level tokens such as $ni-nimble-application-background-color that are dynamic values that change at runtime based on JavaScript, the nimble-theme-provider custom element, and programmatically updating CSS Custom Property values

We should consider having:

  • theme-unaware high-level tokens such as $ni-nimble-application-background-color-light-theme, $ni-nimble-application-background-color-dark-theme, $ni-nimble-application-background-color-color-theme that are static values defined as raw values
  • we should then build the theme-aware high-level tokens from those theme-unaware high-level tokens

Use-cases:

  • Mobiscroll does not support theming using dynamic CSS custom properties and needs statically defined SCSS values (discussion)
  • Gainsights does not support JavaScript execution which is needed for our theme-aware high-level tokens to update dynamically. We could instead generate static CSS styles that use prefers-color-scheme to have top-level page system theme awareness (but no concept of theme-providers to override themes on specific regions of a page dynamically).

💁 Proposed Solution

Partially described above but we need to determine:

  • The naming scheme for theme unaware high-level tokens
  • How to represent the theme-unaware high-level tokens in style dictionary
  • Generation of static CSS that uses the prefers-color-scheme media query (current use-case being gainsights so should see what is actually supported first)

📋 Tasks

@rajsite rajsite added enhancement New feature or request triage New issue that needs to be reviewed labels Jul 17, 2024
@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Jul 23, 2024
@jattasNI
Copy link
Contributor

https://github.com/ni/nimble/pull/2305/files/2699ec4760c024a1d150cea9b3df50c01992c46c revealed some of the challenges in doing this:

  1. we need hierarchy in base tokens to avoid duplicating hex values and to provide clarity about which tokens are atomic color values and which are mapping to component parts / variants
  2. we need a naming scheme that incorporates the many subtle parts / variants / themes / token types
  3. we want a way to simplify the theme-aware token creation so that it doesn't require a single file importing hundreds of base tokens and manually mapping them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants