mirror of
https://github.com/twbs/bootstrap.git
synced 2025-12-28 05:33:57 +00:00
Fix badge theme variable fallback order (#41920)
Some checks failed
BrowserStack / browserstack (push) Has been cancelled
Bundlewatch / bundlewatch (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
cspell / cspell (push) Has been cancelled
CSS / css (push) Has been cancelled
Docs / docs (push) Has been cancelled
JS Tests / JS Tests (push) Has been cancelled
Lint / lint (push) Has been cancelled
Release notes / update_release_draft (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Some checks failed
BrowserStack / browserstack (push) Has been cancelled
Bundlewatch / bundlewatch (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
cspell / cspell (push) Has been cancelled
CSS / css (push) Has been cancelled
Docs / docs (push) Has been cancelled
JS Tests / JS Tests (push) Has been cancelled
Lint / lint (push) Has been cancelled
Release notes / update_release_draft (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Move --bs-theme-* variable usage from CSS variable definitions to property declarations. This ensures the fallback works correctly: - color: var(--bs-theme-contrast, var(--bs-badge-color)) - background-color: var(--bs-theme-bg, var(--bs-badge-bg)) Also fixes .badge-subtle variant to use same pattern.
This commit is contained in:
parent
94bfbe5528
commit
353324bd94
@ -22,8 +22,8 @@ $badge-border-radius: var(--#{$prefix}border-radius) !default;
|
||||
--#{$prefix}badge-padding-y: #{$badge-padding-y};
|
||||
@include rfs($badge-font-size, --#{$prefix}badge-font-size);
|
||||
--#{$prefix}badge-font-weight: #{$badge-font-weight};
|
||||
--#{$prefix}badge-color: var(--#{$prefix}theme-contrast, #{$badge-color});
|
||||
--#{$prefix}badge-bg: var(--#{$prefix}theme-bg, var(--#{$prefix}bg-2));
|
||||
--#{$prefix}badge-color: #{$badge-color};
|
||||
--#{$prefix}badge-bg: var(--#{$prefix}bg-2);
|
||||
--#{$prefix}badge-border-radius: #{$badge-border-radius};
|
||||
// scss-docs-end badge-css-vars
|
||||
|
||||
@ -32,11 +32,11 @@ $badge-border-radius: var(--#{$prefix}border-radius) !default;
|
||||
@include font-size(var(--#{$prefix}badge-font-size));
|
||||
font-weight: var(--#{$prefix}badge-font-weight);
|
||||
line-height: 1;
|
||||
color: var(--#{$prefix}badge-color);
|
||||
color: var(--#{$prefix}theme-contrast, var(--#{$prefix}badge-color));
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
background-color: var(--#{$prefix}badge-bg);
|
||||
background-color: var(--#{$prefix}theme-bg, var(--#{$prefix}badge-bg));
|
||||
@include border-radius(var(--#{$prefix}badge-border-radius));
|
||||
@include gradient-bg();
|
||||
|
||||
@ -53,7 +53,7 @@ $badge-border-radius: var(--#{$prefix}border-radius) !default;
|
||||
}
|
||||
|
||||
.badge-subtle {
|
||||
--#{$prefix}badge-color: var(--#{$prefix}theme-text);
|
||||
--#{$prefix}badge-bg: var(--#{$prefix}theme-bg-subtle);
|
||||
color: var(--#{$prefix}theme-text, var(--#{$prefix}badge-color));
|
||||
background-color: var(--#{$prefix}theme-bg-subtle, var(--#{$prefix}badge-bg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,12 @@ import { getData } from '@libs/data'
|
||||
|
||||
Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. As of v5, badges no longer have focus or hover styles for links.
|
||||
|
||||
### Base badge
|
||||
|
||||
<Example code={`<span class="badge theme-primary">New</span>`} />
|
||||
|
||||
<Example code={`<span class="badge badge-subtle theme-primary">New</span>`} />
|
||||
|
||||
### Headings
|
||||
|
||||
<Example code={`<h1>Example heading <span class="badge">New</span></h1>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user