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

Missing Pressed State Color in Radix UI Solid Button Palette #48

Open
ArturGr opened this issue Oct 3, 2024 · 1 comment
Open

Missing Pressed State Color in Radix UI Solid Button Palette #48

ArturGr opened this issue Oct 3, 2024 · 1 comment

Comments

@ArturGr
Copy link

ArturGr commented Oct 3, 2024

I went through the Radix UI docs on color scales, and while reading, I noticed a gap in the concept for button states. Specifically, the setup for states like 3 normal, 4 hover, and 5 pressed with brand colors 9 normal and 10 hover isn't fully supported—there's no pressed state color defined.

I then checked out the components shown in the documentation, as they do have a distinct color for the pressed state that differs from hover. And guess what? They’re using filters. I find it a bit disappointing to see filters being applied in such a well-thought-out system. In fact, multiple filters are defined there.

Active Button:

.rt-BaseButton:where(.rt-variant-solid):where(:active:not([data-state=open])) {
    background-color: var(--accent-10);
    filter: var(--base-button-solid-active-filter);
}

Vars:

    --base-button-classic-active-filter: brightness(1.08);
    --base-button-classic-high-contrast-hover-filter: contrast(0.88) saturate(1.3) brightness(1.14);
    --base-button-classic-high-contrast-active-filter: brightness(0.95) saturate(1.2);
    --base-button-solid-active-filter: brightness(1.08);
    --base-button-solid-high-contrast-hover-filter: contrast(0.88) saturate(1.3) brightness(1.18);
    --base-button-solid-high-contrast-active-filter: brightness(0.95) saturate(1.2);
    --switch-high-contrast-checked-active-before-filter: brightness(1.08);
    --switch-surface-checked-active-filter: brightness(1.08);

So, my question is: why are additional colors being generated through filters instead of creating a palette that accounts for this common use case? Or, is using filters the only viable solution here?

@baptisteArno
Copy link

Right, why wouldn't it be the color 11?

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

No branches or pull requests

2 participants