Skip to content

fix: correct dark value in getLightDarkValue() for --rh-color-surface#170

Merged
bennypowers merged 3 commits intomainfrom
fix/light-dark-surface
Jul 28, 2025
Merged

fix: correct dark value in getLightDarkValue() for --rh-color-surface#170
bennypowers merged 3 commits intomainfrom
fix/light-dark-surface

Conversation

@zeroedin
Copy link
Contributor

@zeroedin zeroedin commented Jun 12, 2025

What I did

  • Corrected the output for --rh-color-surface in getLightDarkValue().

Because rh-color-surface has many values, not just two possible, we need to grab the first and last in the array instead of just destructuring the array expecting the first two to be correct.

Closes RedHat-UX/red-hat-design-system#2440

@zeroedin zeroedin requested a review from bennypowers June 12, 2025 20:40
@zeroedin zeroedin self-assigned this Jun 12, 2025
@zeroedin zeroedin added the bug Something isn't working label Jun 12, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2025

🦋 Changeset detected

Latest commit: e9a7a21

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rhds/tokens Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jun 12, 2025

Deploy Preview for red-hat-design-tokens ready!

Name Link
🔨 Latest commit e9a7a21
🔍 Latest deploy log https://app.netlify.com/projects/red-hat-design-tokens/deploys/6883ab670ecaba0008c64b99
😎 Deploy Preview https://deploy-preview-170--red-hat-design-tokens.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hellogreg
Copy link

@bennypowers

Copy link
Member

@bennypowers bennypowers left a comment

Choose a reason for hiding this comment

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

I got this in the DP for --rh-color-surface's values:

<samp style="background-color: var(--rh-color-surface-lightest);"></samp>
<samp style="background-color: var(--rh-color-surface-lighter);"></samp>

https://deploy-preview-170--red-hat-design-tokens.netlify.app/#color-surface

likewise for surface status colors

@zeroedin
Copy link
Contributor Author

zeroedin commented Jul 25, 2025

I got this in the DP for --rh-color-surface's values:
...
likewise for surface status colors

Interesting, it builds css/default-theme.css correctly.

  --rh-color-surface:
    light-dark(
      var(--rh-color-surface-lightest, #ffffff),
      var(--rh-color-surface-darkest, #151515)
    );

As well as js/tokens.ts (where it is broken in main)

"--rh-color-surface": "light-dark(var(--rh-color-surface-lightest, #ffffff), var(--rh-color-surface-darkest, #151515))",

I'll look into the docs code and take a look at how it's reading the values and maybe it's doing the same thing by grabbing the first two, rather than the first and last.

@bennypowers
Copy link
Member

if you can validate the built package (with the npm pack, untar, copy trick) against rhds docs, that's good enough for me.

@zeroedin
Copy link
Contributor Author

@bennypowers docs fixed andnpm pack install validated over on RHDS:

image

@bennypowers bennypowers merged commit 338a97d into main Jul 28, 2025
5 checks passed
@bennypowers bennypowers deleted the fix/light-dark-surface branch July 28, 2025 09:43
@github-project-automation github-project-automation bot moved this from Review 🔍 to Done ☑️ in Red Hat Design System Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done ☑️

Development

Successfully merging this pull request may close these issues.

[docs][bug] Surface token docs lists the wrong dark color

3 participants