feat: add opaque buttons and text-opaque utility#3620
Conversation
✅ Deploy Preview for boosted ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| The `.opacify` class is only available for `.btn-strong` buttons. | ||
| </Callout> | ||
|
|
||
| <Example buttonLabel="buttons on colored backgrounds" class="p-none bd-btn-example bd-first-rounded" code={`<div class="bg-surface-brand-primary p-large d-flex gap-xsmall flex-wrap" style="background-image: url('https://fastly.picsum.photos/id/628/1000/300.jpg?hmac=scpBB5Z4eJBipw0O_j2T60oQcGjH8xoOA0OG42tW0go')"> |
There was a problem hiding this comment.
Is this url something internal that can be used in this context ? shouldn't we get this asset in our repo to avoid depending on external resources ?
louismaximepiton
left a comment
There was a problem hiding this comment.
I'm still not convinced of the utility of it. IMO the identified use cases would be largely filled via the existing variants on colored bg in combination with a semi-transparent bg on an image when needed or even a zigzag rather than writing on an image. I feel it's wrong in the direction we want to give to people.
In the meantime, some comments:
| @@ -0,0 +1,4 @@ | |||
| .text-muted.opacify { | |||
There was a problem hiding this comment.
Do you know if there is a name on design side for this .opacify class ?
There was a problem hiding this comment.
There is no design spec for this
|
|
||
| ### Opaque links | ||
|
|
||
| On image background, you can use the `.opacify` class to make links more readable. This class adds an opaque background to the link for the `:hover`, `:focus-visible`, and `:active` states, improving contrast and visibility against complex backgrounds. |
There was a problem hiding this comment.
Does it apply only on some variants of the links ?
|
|
||
| ## Opaque text muted | ||
|
|
||
| On image background, you can use the `.opacify` class to make `.text-muted` more readable. This class adds an opaque background to the text, improving contrast and visibility against complex backgrounds. |
There was a problem hiding this comment.
Why on text-muted only ?
There was a problem hiding this comment.
It's the only semi-transparent color
There was a problem hiding this comment.
We also have .text-disabled but ok I see your point
| &:hover, | ||
| &:active, | ||
| &:focus-visible { | ||
| background-color: var(--bs-color-bg-primary); |
There was a problem hiding this comment.
| background-color: var(--bs-color-bg-primary); | |
| background-color: var(--#{$prefix}color-bg-primary); |
| &:active, | ||
| &:focus-visible { | ||
| background-color: var(--bs-color-bg-primary); | ||
| background-image: linear-gradient(var(--#{$prefix}btn-hover-bg)); |
There was a problem hiding this comment.
Do we keep the hover every time ? Where can the specs be found ?
|
|
||
| On image background, you can use the `.opacify` class to make `.text-muted` more readable. This class adds an opaque background to the text, improving contrast and visibility against complex backgrounds. | ||
|
|
||
| <Example buttonLabel="links on colored backgrounds" class="p-none bd-btn-example bd-first-rounded" code={`<div class="bg-surface-brand-primary p-large d-flex gap-medium flex-wrap" style="background-image: url('https://fastly.picsum.photos/id/534/1000/300.jpg?hmac=uKVRRoCBPDGUvOZ5ZockbHITRiP-GoVWyQ2WtBpcrB8')"> |
There was a problem hiding this comment.
A good accessibility practice is to set a background-color close to the color on the image whenever an image is used. Do you think we should add this good practice in our doc ?
There was a problem hiding this comment.
Ok but do we have enough colors for that?
Types of change
Related issues
Closes #3569
Context & Motivation
Description
Checklists
Checklist (for Core Team only)
Progression (for Core Team only)
ouds/mainfollowing conventional commitLive previews