Skip to content

style: use ionic-ds tokens for colors that match them exactly - #4883

Merged
thetaPC merged 3 commits into
mainfrom
css-ds-tokens
Nov 23, 2026
Merged

thetaPC merged 3 commits into
mainfrom
css-ds-tokens

Conversation

@thetaPC

@thetaPC thetaPC commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

  • 16 colors in 4 stylesheets are hard-coded with the exact value of an ionic-ds token, while the rest of the site's styles use the tokens.
  • Nothing documents where the tokens come from or when to use one.

What is the new behavior?

  • Those 16 values use the matching token: the Release Notes accent scale and badge gray, the dark Playground tab background, the dark page background, and the Native Enterprise card text.
  • Only exact matches are replaced, so nothing renders differently. Values without an identical token, Ionic's default palette in the theming demos, and plain white and black stay as they are.
  • The CSS README explains how the tokens are loaded, which ones the site uses, how the scales and dark mode work, and the exact-match rule.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Screenshots

Every spot whose color now uses a token, built from main and from this branch. All 8 pairs are pixel-identical (0 pixels differ).

Spot Before and after
Release Notes, patch badge and links (light) release-notes-patch-light
Release Notes, patch badge and links (dark) release-notes-patch-dark
Release Notes, major badge (light) release-notes-major-light
Release Notes, major badge (dark) release-notes-major-dark
Native, Enterprise SDK card (light) native-enterprise-card-light
Native, Enterprise SDK card (dark) native-enterprise-card-dark
Playground tabs (dark) playground-tabs-dark
Page background (dark) page-background-dark

The data has no minor releases, so the minor badge, which uses the same gray, doesn't render. The --accent-color-100 to -900 scale isn't used by any rule, so it renders nothing.

@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Nov 23, 2026 11:30pm UTC

Request Review

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me! Just a couple of small things in the README 🚀

Comment thread src/css/README.md Outdated

`customCss` loads `tokens.css` from `@ionic-internal/ionic-ds`, Ionic's design system package, before `custom.scss`, so its custom properties work in every stylesheet, CSS modules included. The site uses its color scales and `--shadow-0`, not its type, spacing, or radius tokens.

- Each color is a scale from `0`, the lightest, to `100`, the darkest, such as `--c-indigo-50` or `--c-blue-70`. Indigo, carbon, and gray step by 10, the other colors by 5.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- Each color is a scale from `0`, the lightest, to `100`, the darkest, such as `--c-indigo-50` or `--c-blue-70`. Indigo, carbon, and gray step by 10, the other colors by 5.
- Each color is a scale that gets darker as the number goes up, such as `--c-indigo-50` or `--c-blue-70`. Indigo, carbon, and gray run from `0` to `100`, the other colors from `0` to `200`, all in steps of 10.

Only indigo, carbon and gray stop at 100. The other colors in tokens.css go up to 200 and nothing steps by 5, so --c-blue-100 is a mid blue (#0054e9) and the darkest one is --c-blue-200. Someone reading this could go looking for a --c-blue-55 that doesn't exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e5c33c5.

Comment thread src/css/README.md Outdated
- A token has the same value in both themes, so a dark style uses a different step under `html[data-theme='dark']` instead of redefining the token.
- Use a token only when its value is exactly the color you need. A near match changes how the page renders, so keep the hard-coded value instead.

The values are in [tokens.css](/node_modules/@ionic-internal/ionic-ds/dist/tokens/tokens.css), once dependencies are installed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The values are in [tokens.css](/node_modules/@ionic-internal/ionic-ds/dist/tokens/tokens.css), once dependencies are installed.
The values are in [tokens.css](https://unpkg.com/@ionic-internal/ionic-ds@8/dist/tokens/tokens.css), also at `node_modules/@ionic-internal/ionic-ds/dist/tokens/tokens.css` once dependencies are installed.

This link 404s on GitHub since node_modules isn't committed, and GitHub is pretty much the only place anyone reads this README. I pinned the unpkg link to @8 so it matches the ^8.0.0 range in package.json. Up to you!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e5c33c5.

@thetaPC
thetaPC merged commit b061116 into main Nov 23, 2026
7 checks passed
@thetaPC
thetaPC deleted the css-ds-tokens branch November 23, 2026 23:45

This branch was successfully deployed

1 active deployment
Preview — 80f7034f Deployed Nov 23, 2026 by vercel[bot]
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.

2 participants