Tsibela kumxholo ophambili Tsiba uye kukhangelo lwamaxwebhu
in English

Imibala

Ukubonisa intsingiselo colorngeqela leeklasi eziluncedo zemibala. Ibandakanya inkxaso yonxibelelwano lwesitayile kunye ne-hover state, nayo.

Imibala

Faka umbala kwisicatshulwa ngezinto eziluncedo zombala. Ukuba ufuna ukufaka imibala kumakhonkco, ungasebenzisa .link-*iiklasi zabancedisi abanazo :hoverkunye :focusnezichazayo.

.isicatshulwa-esisisiseko

.okubhaliweyo-kwesibini

.impumelelo yokubhaliweyo

.ingozi yokubhaliweyo

.isicatshulwa-isilumkiso

.ulwazi olubhaliweyo

.ukukhanya okubhaliweyo

.umbhalo-mnyama

.text-body

.umbhalo-uthulisiwe

.umbhalo-mhlophe

.umbhalo-omnyama-50

.umbhalo-mhlophe-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>
Ukuhoxiswa: Ngokudityaniswa kwezinto .text-opacity-*eziluncedo kunye noguquko lwe-CSS lwezinto ezibhaliweyo, .text-black-50kwaye .text-white-50ziyalahlwa njenge-v5.1.0. Ziya kususwa kwi-v6.0.0.
Ukuhambisa intsingiselo kwiiteknoloji ezincedisayo

Ukusebenzisa umbala ukongeza intsingiselo kubonelela kuphela ngesalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi betekhnoloji encedisayo - njengezifundi zesikrini. Qinisekisa ukuba ulwazi olubonakaliswe ngumbala lucacile kumxholo ngokwawo (umzekelo, umbhalo obonakalayo), okanye luqukwe ngezinye iindlela, ezifana nesicatshulwa esongezelelweyo esifihlwe .visually-hiddeneklasini.

Ukungaboni kakuhle

Ifakwe kwi-v5.1.0

Ukusukela kwi-v5.1.0, izinto eziluncedo zombala wokubhaliweyo ziveliswa nge-Sass kusetyenziswa ii-variables ze-CSS. Oku kuvumela utshintsho lwexesha lokwenyani lombala ngaphandle kokuhlanganiswa kunye notshintsho oluguqukayo lwealpha elubala.

Ingaba isebenza kanjani

Qwalasela usetyenziso lwethu olungagqibekanga .text-primary.

.text-primary {
  --bs-text-opacity: 1;
  color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
}

Sisebenzisa inguqulo ye-RGB yethu --bs-primary(ngexabiso 13, 110, 253) i-CSS eguquguqukayo kwaye incamathele i-CSS yesibini, --bs-text-opacity, ukwenzela ukukhanya kwe-alpha (ngexabiso elingagqibekanga 1enkosi kwi-CSS yengingqi). Oko kuthetha ukuba ngalo naliphi na ixesha usebenzisa .text-primaryngoku, colorixabiso lakho elibaliweyo ngu rgba(13, 110, 253, 1). Uguqulo lwendawo ye-CSS ngaphakathi .text-*kudidi ngalunye luphepha imiba yelifa ukuze iimeko ezibekwe kwindlwane yezixhobo azinakwenzeka ngokuzenzekelayo ukucaca kwealpha okulungisiweyo.

Umzekelo

Ukutshintsha opacity, bhala ngaphezulu --bs-text-opacityngokusebenzisa izimbo ezilungiselelweyo okanye izimbo ezingaphakathi.

Oku kubhaliweyo okusisiseko
Le yi-50% yombhalo wokuqala wokungafihli
<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>

Okanye, khetha kuzo naziphi na .text-opacityeziluncedo:

Oku kubhaliweyo okusisiseko
Le yi-75% yombhalo wokuqala wokungafihli
Le yi-50% yombhalo wokuqala wokungafihli
Le yi-25% yombhalo wokuqala wokungafihli
<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>

Ukuchaza ngokuthe ngqo

Ngamanye amaxesha iiklasi zomxholo azinakusetyenziswa ngenxa yento ethile yomnye umkhethi. Kwezinye iimeko, i-workaround eyaneleyo kukusonga umxholo wento yakho <div>okanye ngaphezulu kwesemantic kunye neklasi oyifunayo.

Sass

Ukongeza koku kulandelayo ukusebenza kweSass, cinga ngokufunda malunga neempawu zethu zesiko le-CSS ezibandakanyiweyo (eziguquguqukayo ze-CSS) ngemibala kunye nokunye.

Izinto eziguquguqukayo

Uninzi lwezinto coloreziluncedo ziveliswa nemibala yethu yomxholo, yabelwa ngokutsha ukusuka kwiphalethi yethu yemibala eyahlukeneyo.

$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;

Imibala engwevu nayo iyafumaneka, kodwa iseti encinci kuphela esetyenziswayo ukwenza naziphi na izinto eziluncedo.

$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;

Imephu

Imibala yomxholo ithi emva koko ifakwe kwimephu ye-Sass ukuze sikwazi ukujikeleza phezu kwayo ukuze sivelise izixhobo zethu eziluncedo, izilungisi zecandelo, kunye nokunye.

$theme-colors: (
  "primary":    $primary,
  "secondary":  $secondary,
  "success":    $success,
  "info":       $info,
  "warning":    $warning,
  "danger":     $danger,
  "light":      $light,
  "dark":       $dark
);

Imibala engwevu nayo iyafumaneka njengemephu ye-Sass. Le mephu ayisetyenziswa ukwenza naziphi na izinto eziluncedo.

$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
);

Imibala ye-RGB iveliswa kwimephu ye-Sass eyahlukileyo:

$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");

Kwaye umbala opacities wakhela kuloo nto ngemephu yabo etyiwa zizixhobo ze-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

Izinto eziluncedo zombala zibhengezwe kwizinto zethu ze-API kwi scss/_utilities.scss. Funda indlela yokusebenzisa izinto eziluncedo 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
      )
    ),