Skip to content

Fix / INT-744 / Keep dark gray tints one step off the panel surface - #55

Open
RobinAtherton wants to merge 4 commits into
mainfrom
fix/int-744-dark-gray-tints-off-panel
Open

RobinAtherton wants to merge 4 commits into
mainfrom
fix/int-744-dark-gray-tints-off-panel

Conversation

@RobinAtherton

Copy link
Copy Markdown
Contributor

Why

Follow-up to hivemq/ui-library#42 and the CCv2 dark-mode work in INT-744. With bg.panel at gray.900 in dark mode (#54), every gray-scale tint that starts at gray.900 is invisible on a card or the sidebar:

  • secondary.subtle is gray.900 in dark mode, the same as bg.panel. Table row hovers, selected menu items and filter chips that use it disappear.
  • Chakra's own gray.subtle / gray.muted / gray.emphasized have the same ramp (gray.900 / 800 / 700), so colorPalette="gray" and Chakra's table row hover (colorPalette.subtle) hit the same problem.
  • ui-library#42 had to work around this with a per-mode { base: 'secondary.muted', _dark: 'secondary.emphasized' } object for the selected sidebar item, and the divider needed secondary.emphasized to show up at all.
  • The shell.* deprecation note still says "guidance will be added later", so consumers removing them have nothing to follow.

What

  • Shift the dark ramp of secondary.subtle / muted / emphasized from gray.900 / 800 / 700 to gray.800 / 700 / 600, one step off bg.panel. solid and focusRing are unchanged. Light values are unchanged.
  • Override Chakra's gray.subtle / muted / emphasized with the same ramp. Other gray.* keys stay Chakra's.
  • Replace the shell.* placeholder with the replacement tokens (bg, bg.panel, bg.muted, secondary.muted, secondary.emphasized, content.tertiary, content.primary). Values are kept, nothing breaks.
  • Add a system test that fails if any secondary.* / gray.* tint equals bg.panel or bg in dark mode. It fails on main.

Visible changes: dark mode only. Anything using secondary.subtle/muted/emphasized or gray.subtle/muted/emphasized gets one step lighter. Light mode is pixel-identical.

Once released, ui-library can drop the per-mode activeBg object and use secondary.muted directly.

Test plan

  • pnpm lint:all passes
  • theme: pnpm test:unit 61 passed (6 new), pnpm build passes
  • testing: pnpm test:unit 116 passed
  • New layering test fails on main (2 of 6: secondary.subtle, gray.subtle)

secondary.subtle/muted/emphasized and Chakra's gray.* read gray.900/800/700
in dark mode, but surfaces (bg.panel) are gray.900, so hover, selected and
divider tints on cards and the sidebar were invisible. The dark ramp now
starts at gray.800. Light values are unchanged.

Also replaces the deprecated shell.* placeholder note with the tokens to
use instead, and adds a system test that fails if any gray tint equals
bg.panel or bg in dark mode.

@aslamshah-hivemq aslamshah-hivemq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. I will check the other theme pr

@aslamshah-hivemq aslamshah-hivemq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Moving the dark gray tints off bg.panel makes sense. One dark-mode regression to fix before merging, plus a test note, see inline.

Comment thread theme/src/colors/semantic-tokens.ts Resolved
describe('Dark mode layering', () => {
// A hover, selected or divider tint that equals the surface it sits on is invisible. Surfaces
// are `bg.panel` in dark mode, so every gray-scale tint has to differ from it (and from the page).
const grayTints = ['secondary', 'gray'].flatMap((palette) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Chakra's bg.subtle, border.subtle and border.muted have the same problem: they match the page or panel color in dark mode, and partly in light mode. This was already the case before this PR, so it could be a follow-up, but worth adding to this list.

Also, the test compares var(...) strings, so a token that points at bg.panel through an alias would still pass.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fine to leave this for a follow-up. Could you create a ticket for it?

@aslamshah-hivemq aslamshah-hivemq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please check the comments

@aslamshah-hivemq aslamshah-hivemq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The contrast fix and the field background changes look good. CI passes, and dark mode checks out in the playground, including native date pickers. Approving.

Minor, non-blocking:

  • Dark secondary.solid (gray.700) now matches secondary.muted, so a hovered subtle secondary button looks like the solid one, and solid sits below emphasized (gray.600). Worth a look in a follow-up.
  • Could drop the name from the //RobinAtherton - … comment in config.ts, since git blame covers that.

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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants