Mebala
Hlahisa moelelo ka color
lihlopha tse 'maloa tsa lisebelisoa tsa mebala. E kenyelletsa tšehetso bakeng sa likhokahano tsa setaele le libaka tsa hover, hape.
Mebala
Kenya mebala ka lisebelisoa tsa mebala. Haeba u batla ho kenya lihokelo ka mebala, u ka sebelisa .link-*
litlelase tsa bathusi tse nang :hover
le le :focus
ho re.
.mongolo-motheo
.mongolo-bobedi
.katleho ya mongolo
.kotsi ea mongolo
.temoso ya mongolo
.mangolo-tsebiso
.sengolo-lebone
.mongolo-fifi
.mongolo-mmele
.mongolo o kgutsitse
.mongolo-tshweu
.mongolo-botsho-50
.mongolo-bosweu-50
<p class="text-primary">.text-primary</p>
<p class="text-secondary">.text-secondary</p>
<p class="text-success">.text-success</p>
<p class="text-danger">.text-danger</p>
<p class="text-warning bg-dark">.text-warning</p>
<p class="text-info bg-dark">.text-info</p>
<p class="text-light bg-dark">.text-light</p>
<p class="text-dark">.text-dark</p>
<p class="text-body">.text-body</p>
<p class="text-muted">.text-muted</p>
<p class="text-white bg-dark">.text-white</p>
<p class="text-black-50">.text-black-50</p>
<p class="text-white-50 bg-dark">.text-white-50</p>
.text-opacity-*
lisebelisoa le mefuta-futa ea CSS bakeng sa lisebelisoa tsa mongolo,
.text-black-50
'me
.text-white-50
li tlositsoe ho tloha v5.1.0. Li tla tlosoa ka v6.0.0.
Ho fetisa moelelo ho litheknoloji tse thusang
Ho sebelisa mebala ho eketsa moelelo ho fana feela ka pontšo ea pono, e ke keng ea fetisetsoa ho basebelisi ba theknoloji e thusang - joalo ka sebali sa skrine. Netefatsa hore tlhahisoleseding e hlahisitsweng ke mmala e ka ba e totobetseng ho tswa ho dikahare ka boyona (mohlala, mongolo o bonahalang), kapa e kenyeleditswe ka mekgwa e meng, e kang mongolo o tlatsetso o patilweng le .visually-hidden
sehlopha.
Opacity
E kentsoe ho v5.1.0
Ho tloha ka v5.1.0, lisebelisoa tsa mebala ea mongolo li hlahisoa ka Sass ho sebelisa mefuta-futa ea CSS. Sena se lumella liphetoho tsa 'mala oa nako ea' nete ntle le ho bokelloa le liphetoho tse hlakileng tsa alpha.
Kamoo e sebetsang kateng
Nahana ka .text-primary
lisebelisoa tsa rona tsa kamehla.
.text-primary {
--bs-text-opacity: 1;
color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
}
Re sebelisa mofuta oa RGB oa rona --bs-primary
(o nang le boleng ba 13, 110, 253
) CSS e feto-fetohang le ho hokela mofuta oa bobeli oa CSS, --bs-text-opacity
, bakeng sa ponaletso ea alpha (ka boleng ba kamehla bo 1
lebohang CSS ea lehae). Seo se bolela hore neng kapa neng ha u sebelisa .text-primary
hona joale, boleng ba hau ba komporo color
ke rgba(13, 110, 253, 1)
. Phapang ea lehae ea CSS ka har'a .text-*
sehlopha ka seng e qoba mathata a lefa kahoo maemo a teng a lits'ebeletso a se ke a ba le ponaletso ea alpha e fetotsoeng.
Mohlala
Ho fetola opacity eo, hlakola --bs-text-opacity
ka mekhoa e tloaelehileng kapa mekhoa e ka har'a mela.
<div class="text-primary">This is default primary text</div>
<div class="text-primary" style="--bs-text-opacity: .5;">This is 50% opacity primary text</div>
Kapa, khetha ho efe kapa efe ea .text-opacity
lisebelisoa:
<div class="text-primary">This is default primary text</div>
<div class="text-primary text-opacity-75">This is 75% opacity primary text</div>
<div class="text-primary text-opacity-50">This is 50% opacity primary text</div>
<div class="text-primary text-opacity-25">This is 25% opacity primary text</div>
Tse khethehileng
Ka linako tse ling litlelase tsa maemo a itseng li ke ke tsa sebelisoa ka lebaka la khetho ea mokhethoa e mong. Maemong a mang, mokhoa o lekaneng oa ho sebetsa ke ho thatela litaba tsa element ea hau ka karolo ea <div>
semantic kapa ho feta ka sehlopha seo u se batlang.
Sass
Ntle le ts'ebetso e latelang ea Sass, nahana ka ho bala ka thepa ea rona e kenyellelitsoeng ea CSS (mefuta e fapaneng ea CSS) bakeng sa mebala le tse ling.
Lintho tse fapaneng
Lisebelisoa tse ngata color
li hlahisoa ke mebala ea rona ea sehlooho, e abetsoeng bocha ho tsoa ho mefuta ea rona ea mebala e tloaelehileng.
$blue: #0d6efd;
$indigo: #6610f2;
$purple: #6f42c1;
$pink: #d63384;
$red: #dc3545;
$orange: #fd7e14;
$yellow: #ffc107;
$green: #198754;
$teal: #20c997;
$cyan: #0dcaf0;
$primary: $blue;
$secondary: $gray-600;
$success: $green;
$info: $cyan;
$warning: $yellow;
$danger: $red;
$light: $gray-100;
$dark: $gray-900;
Mebala ea Grayscale le eona ea fumaneha, empa ho sebelisoa karoloana feela ho hlahisa lisebelisoa life kapa life.
$white: #fff;
$gray-100: #f8f9fa;
$gray-200: #e9ecef;
$gray-300: #dee2e6;
$gray-400: #ced4da;
$gray-500: #adb5bd;
$gray-600: #6c757d;
$gray-700: #495057;
$gray-800: #343a40;
$gray-900: #212529;
$black: #000;
'Mapa
Mebala ea theme e tla beoa 'mapeng oa Sass hore re tsebe ho o pota-pota ho hlahisa lisebelisoa tsa rona, lintlafatso tsa likarolo, le tse ling.
$theme-colors: (
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
);
Mebala ea Grayscale e fumaneha hape joalo ka 'mapa oa Sass. 'Mapa ona ha o sebelisoe ho hlahisa lisebelisoa.
$grays: (
"100": $gray-100,
"200": $gray-200,
"300": $gray-300,
"400": $gray-400,
"500": $gray-500,
"600": $gray-600,
"700": $gray-700,
"800": $gray-800,
"900": $gray-900
);
Mebala ea RGB e hlahisoa 'mapeng o fapaneng oa Sass:
$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
'Me opacities ea mebala e haha ho eona ka' mapa oa bona o sebelisoang ke lisebelisoa tsa API:
$utilities-text: map-merge(
$utilities-colors,
(
"black": to-rgb($black),
"white": to-rgb($white),
"body": to-rgb($body-color)
)
);
$utilities-text-colors: map-loop($utilities-text, rgba-css-var, "$key", "text");
Utilities API
Lisebelisoa tsa mebala li hlahisoa lits'ebetsong tsa rona tsa API ho scss/_utilities.scss
. Ithute ho sebelisa lisebelisoa tsa API.
"color": (
property: color,
class: text,
local-vars: (
"text-opacity": 1
),
values: map-merge(
$utilities-text-colors,
(
"muted": $text-muted,
"black-50": rgba($black, .5), // deprecated
"white-50": rgba($white, .5), // deprecated
"reset": inherit,
)
)
),
"text-opacity": (
css-var: true,
class: text-opacity,
values: (
25: .25,
50: .5,
75: .75,
100: 1
)
),