Fa'ase'e ile anotusi autu Fa'ase'e ile su'ega fa'amatalaga

Fa'ailoa atu uiga colorfa'atasi ma nai vasega fa'aoga lanu. E aofia ai le lagolago mo le fa'avasegaina o feso'ota'iga ma tulaga fa'afefe, fo'i.

Lanu

Valivali tusitusiga i mea aoga lanu. Afai e te manaʻo e valivali soʻotaga, e mafai ona e faʻaogaina .link-*vasega fesoasoani o loʻo i ai :hoverma :focussetete.

.text-primary

.text-secondary

.manuia-manuia

.tulaga-tulaga

.text-lapataiga

.text-info

.text-light

.text-pouliuli

.text-body

.text-muted

.text-pa'epa'e

.text-black-50

.text-white-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>
Fa'ate'aina: Fa'atasi ai ma le fa'aopoopoina o .text-opacity-*mea fa'aoga ma fesuiaiga CSS mo fa'aoga tusi, .text-black-50ma .text-white-50ua fa'ate'aina e pei o le v5.1.0. O le a aveesea i le v6.0.0.
Tu'uina atu le uiga i tekinolosi fesoasoani

O le fa'aogaina o le lanu e fa'aopoopo ai le uiga e na'o se fa'aaliga va'aia, e le fa'ailoa atu i tagata fa'aoga o tekonolosi fesoasoani - e pei o le au faitau mata. Ia fa'amautinoa o fa'amatalaga o lo'o fa'ailogaina i le lanu e manino mai le anotusi lava ia (fa'ata'ita'iga o tusitusiga va'aia), pe fa'aofi mai i isi auala, e pei o tusitusiga fa'aopoopo natia i le .visually-hiddenvasega.

Opacity

Fa'aopoopo i le v5.1.0

E pei o le v5.1.0, o fa'aoga lanu o tusitusiga o lo'o fa'atupuina ma Sass e fa'aaoga ai suiga CSS. Ole mea lea e fa'atagaina ai suiga ole lanu ile taimi moni e aunoa ma le tu'ufa'atasia ma suiga fa'amanino ole alafa'a.

E faapefea ona galue

Mafaufau i la matou fa'aoga fa'aletonu .text-primary.

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

Matou te faʻaogaina se RGB version o la matou --bs-primary(faʻatasi ai ma le tau o le 13, 110, 253) CSS fesuiaiga ma faʻapipiʻi se fesuiaiga CSS lona lua, --bs-text-opacity, mo le faʻamalamalamaina o le alafaʻa (faʻatasi ai ma se tau le aoga 1faʻafetai i se fesuiaiga CSS i le lotoifale). O lona uiga o so'o se taimi e te fa'aogaina .text-primarynei, o lau colortau fa'atatau o le rgba(13, 110, 253, 1). Ole suiga ole CSS ile lotoifale i totonu ole .text-*vasega ta'itasi e aloese mai fa'afitauli tau tofi ina ia le otometi le fa'aogaina ole fa'aoga ole fa'aoga ole alafa.

Faataitaiga

Ina ia suia lena opacity, soloia --bs-text-opacitye ala i sitaili masani poʻo sitaili laina.

Ole mea lea ole tusitusiga muamua
O le 50% opacity tusitusiga muamua
<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>

Po'o, filifili mai so'o se .text-opacitymea aoga:

Ole mea lea ole tusitusiga muamua
Ole 75% ole opacity tusitusiga muamua
O le 50% opacity tusitusiga muamua
Ole 25% ole opacity tusitusiga muamua
<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>

Fa'apitoa

O nisi taimi e le mafai ona fa'aogaina vasega fa'apitoa ona o le fa'apitoa o le isi tagata filifilia. I nisi tulaga, o se mea e lava le faʻaogaina o le afifiina o mea o loʻo i totonu o lau elemene ile <div>semantic element pe sili atu ma le vasega manaʻomia.

Sass

I le faaopoopo atu i le Sass o loʻo mulimuli mai, mafaufau e faitau e uiga i a matou mea faʻapitoa a le CSS e aofia ai (aka CSS fesuiaiga) mo lanu ma isi mea.

Fuafuaga

Ole tele coloro mea fa'aoga e fa'atupuina e a tatou lanu autu, toe tofia mai a tatou pa'u lanu lanu eseese.

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

O lo'o avanoa fo'i lanu lanu efuefu, ae na'o se vaega itiiti e fa'aaogaina e fa'atupu ai so'o se mea aoga.

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

Fa'afanua

Ona tu'u lea o lanu autu i totonu o le faafanua Sass ina ia mafai ona tatou fa'asolo i luga e fa'atupu ai a tatou mea fa'aoga, mea e sui ai vaega, ma isi mea.

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

O lo'o avanoa fo'i lanu lanu efuefu e fai ma fa'afanua Sass. O lenei fa'afanua e le fa'aogaina e fa'atupu ai so'o se mea fa'aoga.

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

O lanu RGB e fa'atupuina mai se fa'afanua Sass ese:

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

Ma o pa'aga lanu e fausia i luga o latou lava fa'afanua o lo'o fa'aaogaina e le aoga 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

O mea aoga lanu o lo'o fa'aalia i totonu oa tatou mea aoga API i scss/_utilities.scss. A'oa'o pe fa'afefea ona fa'aoga mea aoga 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
      )
    ),