-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Doc: use .text-bg-{color}
for all badges
#39214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have a different color palette for dark mode, it looks harmful for basic users.
However, for advanced users that might want to implement a different color palette using dark mode, they might have some issues because :
The calculated color value from .text-bg-*
helper comes from color-contrast()
applied on theme-colors
so it won't support CSS variables. -> Should we introduce something to handle this use case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rethinking about this, I might overthinked a bit on this since we don't have CSS variables right now. Let's go for it !
@mdo friendly ping for a double-check :) Adding you as a reviewer. If not available, don't hesitate to tell me, and then we'll merge the PR. |
Description
This PR suggests using
.text-bg-{color}
all the time when badges are used.Note that https://deploy-preview-39214--twbs-bootstrap.netlify.app/docs/5.3/utilities/position/#examples still uses
.bg-danger
as there's no text in this rounded badge.Motivation & Context
The rendering is the same in Bootstrap documentation because the same color palette is used whether we are in light or dark mode (see our
$theme-colors
).However, when a project needs to have specific colors for the dark mode, it needs to create a
$theme-colors-dark
. It will imply that the background and text colors will be different for.text-bg-{color}
.Without this change, our badges would have the right background color in dark mode, but the text color wouldn't be the right one.
Type of changes
Checklist
npm run lint
)Live previews