Dathan
Thoir brìgh troimhe color
le dòrlach de chlasaichean goireasan dath. A’ toirt a-steach taic airson ceanglaichean stoidhle le stàitean hover cuideachd.
Dathan
Dèan dath air teacsa le goireasan dath. Ma tha thu airson ceanglaichean a dhath, faodaidh tu na .link-*
clasaichean cuideachaidh aig a bheil :hover
agus :focus
ag ràdh a chleachdadh.
.text-bun-sgoile
.text-àrd-sgoile
.text-soirbheachas
.text-cunnart
.teacs-rabhadh
.teacs-fiosrachaidh
.teacs-solais
.teacs-dhorcha
.teacs-chorp
.teacs-thàmh
.teacs-gheal
.text-dubh-50
.text-geal-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-*
goireasan agus caochladairean CSS a bharrachd airson goireasan teacsa,
.text-black-50
agus
.text-white-50
tha iad air an ìsleachadh mar v5.1.0. Thèid an toirt air falbh ann an v6.0.0.
A’ toirt brìgh do theicneòlasan cuideachail
Chan eil a bhith a’ cleachdadh dath gus brìgh a chur ris ach a’ toirt seachad sealladh lèirsinneach, nach tèid a thoirt do luchd-cleachdaidh theicneòlasan taice - leithid leughadairean sgrion. Dèan cinnteach gu bheil fiosrachadh air a chomharrachadh leis an dath an dàrna cuid follaiseach bhon t-susbaint fhèin (me an teacsa faicsinneach), no air a thoirt a-steach tro dhòighean eile, leithid teacsa a bharrachd falaichte leis a’ .visually-hidden
chlas.
Neo-sheasmhachd
Air a chur ris ann an v5.1.0Mar v5.1.0, thèid goireasan dath teacsa a chruthachadh le Sass a’ cleachdadh caochladairean CSS. Leigidh seo le atharrachaidhean dath fìor-ùine gun a bhith a’ cur ri chèile agus atharrachaidhean follaiseachd alpha fiùghantach.
Mar a tha e ag obair
Beachdaich air ar .text-primary
goireas bunaiteach.
.text-primary {
--bs-text-opacity: 1;
color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
}
Bidh sinn a’ cleachdadh dreach RGB den chaochladair CSS againn --bs-primary
(le luach 13, 110, 253
) agus cheangail sinn dàrna caochladair CSS, --bs-text-opacity
, airson follaiseachd alpha (le luach bunaiteach mar 1
thoradh air caochladair CSS ionadail). Tha sin a’ ciallachadh uair sam bith a chleachdas tu a -nis, is e an luach .text-primary
àireamhaichte agad . Bidh an caochladair CSS ionadail taobh a-staigh gach clas a’ seachnadh cùisean oighreachd agus mar sin chan eil follaiseachd alpha atharraichte aig eisimpleirean neadachaidh de na goireasan gu fèin-ghluasadach.color
rgba(13, 110, 253, 1)
.text-*
eisimpleir
Gus an neo-sheasmhachd sin atharrachadh, cuir thairis --bs-text-opacity
tro stoidhlichean àbhaisteach no stoidhlichean in-loidhne.
<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>
No, tagh bho gin de na .text-opacity
goireasan:
<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>
Sònrachadh
Aig amannan chan urrainnear clasaichean co-theacsail a chuir an sàs air sgàth sònrachas neach-taghaidh eile. Ann an cuid de chùisean, is e dòigh-obrach gu leòr a th’ ann susbaint an eileamaid agad a phasgadh ann an eileamaid <div>
no barrachd semantach leis a’ chlas a tha thu ag iarraidh.
Sass
A bharrachd air na gnìomhan Sass a leanas, smaoinich air leughadh mu na feartan àbhaisteach CSS againn (aka caochladairean CSS) airson dathan agus barrachd.
Caochlaidhean
Tha a’ mhòr- chuid de color
ghoireasan air an gineadh leis na dathan cuspair againn, air an ath-shònrachadh bho na caochladairean paileas dath coitcheann againn.
$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;
Tha dathan sgèile-ghlais rim faighinn cuideachd, ach chan eilear a’ cleachdadh ach fo-sheata gus goireasan sam bith a ghineadh.
$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
Bidh dathan cuspair an uairsin air an cur ann am mapa Sass gus an urrainn dhuinn lùbadh thairis orra gus na goireasan againn, mion-atharraichean phàirtean, agus barrachd a ghineadh.
$theme-colors: (
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
);
Tha dathan sgèile-ghlais cuideachd rim faighinn mar mhapa Sass. Chan eil am mapa seo air a chleachdadh gus goireasan sam bith a ghineadh.
$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
);
Tha dathan RGB air an gineadh bho mhapa Sass air leth:
$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
Agus bidh neo-sheasmhachd dath a’ togail air sin leis a’ mhapa aca fhèin a bhios an API goireasach ag ithe:
$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
Tha goireasan dath air an ainmeachadh anns na goireasan API againn ann an scss/_utilities.scss
. Ionnsaich mar a chleachdas tu an API Utilities.
"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
)
),