Mafere na isi ọdịnaya Gaa na ntugharị docs
Check

Jiri colorklaasị ịba uru na-acha odo odo wepụta ihe pụtara. Gụnyere nkwado maka ịke njikọ yana steeti hover, kwa.

Agba

Jiri ihe eji agba agba ederede ederede. Ọ bụrụ na ịchọrọ ime ka njikọ agba agba, ị nwere ike iji .link-*klaasị ndị enyemaka nke nwere :hoverna :focussteeti.

.ederede-isi

.ederede-secondary

.ederede-aga nke ọma

.ederede-ihe egwu

.ederede ịdọ aka ná ntị

.ederede-ozi

.ederede-ọkụ

.ederede-ọchịchịrị

.ederede-ahụ

.ederede emechiri

.ederede-ọcha

.ederede-oji-50

.ederede-ọcha-50

html
<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>
Mwepu: Site na mgbakwunye nke .text-opacity-*akụrụngwa na mgbanwe CSS maka akụrụngwa ederede, .text-black-50ma na .text-white-50-emebi emebi dị ka nke v5.1.0. A ga-ewepụ ha na v6.0.0.
Na-eme ka ọ pụta ìhè na teknụzụ enyemaka

Iji agba iji gbakwunye ihe ọ pụtara naanị na-enye ihe ngosi anya, nke a na-agaghị ebugara ndị ọrụ teknụzụ enyemaka - dị ka ndị na-agụ ihuenyo. Gbaa mbọ hụ na ozi nke agba gosipụtara pụtara ìhè site na ọdịnaya n'onwe ya (dịka ederede a na-ahụ anya), ma ọ bụ tinye ya site na ụzọ ọzọ, dị ka ederede agbakwunyere zoro ezo na .visually-hiddenklaasị.

Opekempe

Agbakwunyere na v5.1.0

Dịka nke v5.1.0, a na-eji Sass mepụta akụrụngwa agba ederede site na iji mgbanwe CSS. Nke a na-enye ohere maka mgbanwe agba n'ezie na-enweghị nchịkọta na mgbanwe nghọta alfa dị ike.

Ka o si arụ ọrụ

Tụlee uru ndabara anyị .text-primary.

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

Anyị na-eji ụdị RGB nke anyị --bs-primary(nwere uru nke 13, 110, 253) CSS variable wee tinye nke abụọ CSS variable, --bs-text-opacity, maka nghọta alfa (ya na uru ndabara 1ekele maka mgbanwe CSS mpaghara). Nke ahụ pụtara na oge ọ bụla ị na-eji .text-primaryugbu a, uru gị agbakọrọ colorbụ rgba(13, 110, 253, 1). Ngbanwe CSS dị na mpaghara n'ime .text-*klaasị ọ bụla na-ezere okwu nketa ka ihe atụ nke akụrụngwa ghara inwe nghọta alfa gbanwere ozugbo.

Ọmụmaatụ

Ka ịgbanwee oghere ahụ, kpochapụ --bs-text-opacitysite na ụdị omenala ma ọ bụ ụdị ahịrị.

Nke a bụ ederede izizi
Nke a bụ ederede izizi 50% opacity
html
<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>

Ma ọ bụ, họrọ n'ime ngwa .text-opacityọrụ ọ bụla:

Nke a bụ ederede izizi
Nke a bụ 75% ederede izizi
Nke a bụ ederede izizi 50% opacity
Nke a bụ 25% ederede izizi
html
<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>

Nkọwapụta

Mgbe ụfọdụ, enweghị ike itinye klaasị gburugburu n'ihi nkọwapụta nke onye ọzọ. N'ọnọdụ ụfọdụ, ihe ngwọta zuru oke bụ iji <div>klaasị achọrọ kechie ọdịnaya mmewere gị n'ime ihe ọmụmụ ma ọ bụ karịa.

Sass

Na mgbakwunye na ọrụ Sass ndị a, tụlee ịgụ gbasara njirimara omenala CSS anyị gụnyere (aka CSS variables) maka agba na ndị ọzọ.

Mgbanwe

A colorna-emepụta ọtụtụ ngwa ngwa site na agba isiokwu anyị, nke e kenyere ya site na mgbanwe palette agba anyị.

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

A na-enwekwa agba isi awọ, mana ọ bụ naanị obere ihe ka a na-eji wepụta akụrụngwa ọ bụla.

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

Maapụ

A na-etinyezi agba isiokwu n'ime maapụ Sass ka anyị nwee ike ijide ha iji mepụta akụrụngwa anyị, ihe mgbanwe akụrụngwa na ndị ọzọ.

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

Agba isi awọ dịkwa ka maapụ Sass. Ejighị maapụ a mepụta akụrụngwa ọ bụla.

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

Emepụtara agba RGB site na maapụ Sass dị iche:

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

Na ohere agba na-eji maapụ nke aka ha nke ngwa API na-eri na nke ahụ:

$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

A na-ekwupụta ngwa ọrụ agba na API ngwa anyị na scss/_utilities.scss. Mụta otu esi eji ngwa 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
      )
    ),