Agba
Sistemu agba sara mbara na-akwado ụdị na akụrụngwa anyị. Nke a na-enyere aka nhazi na ndọtị karịa maka ọrụ ọ bụla.
Agba isiokwu
Anyị na-eji akụkụ nke agba niile mepụta obere palette agba maka imepụta atụmatụ agba, dịkwa ka Sass variables na maapụ Sass na scss/_variables.scss
faịlụ Bootstrap.
Agba ndị a niile dị ka maapụ Sass, $theme-colors
.
$theme-colors: (
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
);
Lelee maapụ Sass anyị na docs loops maka otu esi agbanwe agba ndị a.
Agba niile
Agba Bootstrap niile dị ka Sass variables na maapụ Sass na scss/_variables.scss
faịlụ. Iji zere nha faịlụ abawanye, anyị anaghị emepụta klaasị ederede ma ọ bụ ndabere ndabere maka mgbanwe ndị a ọ bụla. Kama, anyị na-ahọrọ mpaghara nke agba ndị a maka palette isiokwu .
Jide n'aka na ị na-enyocha oke ọdịiche ka ị na-ahazi agba. Dị ka egosiri n'okpuru, anyị atụkwasịla ọnụ ọgụgụ dị iche iche atọ na agba nke ọ bụla - otu maka agba swatch ugbu a, otu megide ọcha, na otu megide ojii.
Ihe edeturu na Sass
Sass enweghị ike ịmepụta mgbanwe na mmemme, yabụ anyị jiri aka mepụta mgbanwe maka tint ọ bụla na ndò onwe anyị. Anyị na-akọwapụta uru midpoint (dịka ọmụmaatụ $blue-500
) ma na-eji ọrụ agba omenala iji tint (gbachapụ) ma ọ bụ ndò (gba ọchịchịrị) agba anyị site na mix()
ọrụ agba Sass.
Iji mix()
abụghị otu lighten()
na darken()
- nke mbụ na-agwakọta agba akọwapụtara na ọcha ma ọ bụ oji, ebe nke ikpeazụ na-edozi uru dị mfe nke agba ọ bụla. Ihe si na ya pụta bụ agba agba zuru oke, dị ka egosiri na ngosi CodePen a .
Anyị tint-color()
na shade-color()
ọrụ anyị na-eji mix()
n'akụkụ $theme-color-interval
mgbanwe anyị, nke na-akọwapụta uru pasentị rịgoro maka agba agwakọta ọ bụla anyị mepụtara. Hụ scss/_functions.scss
na scss/_variables.scss
faịlụ maka koodu isi mmalite zuru ezu.
Maapụ Sass agba
Faịlụ Sass isi Bootstrap gụnyere maapụ atọ iji nyere gị aka ngwa ngwa na ngwa ngwa kpọchie ndepụta agba na ụkpụrụ hex ha.
$colors
depụtara500
agba agba ( ) niile dị anyị$theme-colors
depụtara agba isiokwu niile ahaziri n'usoro semant ( egosiri n'okpuru)$grays
depụtara niile tints na ndò nke isi awọ
N'ime scss/_variables.scss
, ị ga-ahụ mgbanwe agba Bootstrap na maapụ Sass. Nke a bụ ọmụmaatụ nke $colors
maapụ Sass:
$colors: (
"blue": $blue,
"indigo": $indigo,
"purple": $purple,
"pink": $pink,
"red": $red,
"orange": $orange,
"yellow": $yellow,
"green": $green,
"teal": $teal,
"cyan": $cyan,
"white": $white,
"gray": $gray-600,
"gray-dark": $gray-800
);
Tinye, wepụ, ma ọ bụ gbanwee ụkpụrụ dị n'ime maapụ ahụ iji melite otu esi eji ha n'ọtụtụ ihe ndị ọzọ. Ọ dị nwute na oge a, ọ bụghị akụrụngwa ọ bụla na-eji maapụ Sass a. Mmelite ga-eme n'ọdịnihu ga-agbalịsi ike imeziwanye nke a. Ruo mgbe ahụ, mee atụmatụ iji ${color}
mgbanwe ndị a na maapụ Sass a.
Ọmụmaatụ
Nke a bụ otu ị ga-esi jiri ndị a na Sass gị:
.alpha { color: $purple; }
.beta {
color: $yellow-300;
background-color: $indigo-900;
}
klaasị uru agba na ndabere dịkwa maka ịtọ color
na background-color
iji 500
ụkpụrụ agba.
Na-emepụta akụrụngwa
Agbakwunyere na v5.1.0
Bootstrap anaghị agụnye color
yana background-color
akụrụngwa maka mgbanwe agba ọ bụla, mana ị nwere ike iwepụta ndị a n'onwe gị site na iji API ịba uru anyị yana maapụ Sass agbakwunyere na v5.1.0.
- Iji malite, gbaa mbọ hụ na ibubatala ọrụ anyị, mgbanwe, mixins na akụrụngwa anyị.
- Jiri
map-merge-multiple()
ọrụ anyị jikọta ọtụtụ maapụ Sass ọnụ na maapụ ọhụrụ. - Jikọọ maapụ jikọtara ọhụrụ a iji gbasaa ọrụ ọ bụla nwere
{color}-{level}
aha klaasị.
Nke a bụ ihe atụ na-ewepụta akụrụngwa agba ederede (dịka ọmụmaatụ, .text-purple-500
) site na iji usoro ndị a dị n'elu.
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
$all-colors: map-merge-multiple($blues, $indigos, $purples, $pinks, $reds, $oranges, $yellows, $greens, $teals, $cyans);
$utilities: map-merge(
$utilities,
(
"color": map-merge(
map-get($utilities, "color"),
(
values: map-merge(
map-get(map-get($utilities, "color"), "values"),
(
$all-colors
),
),
),
),
)
);
@import "bootstrap/scss/utilities/api";
Nke a ga-emepụta ngwa ọhụrụ .text-{color}-{level}
maka agba na ọkwa ọ bụla. Ị nwere ike ịme otu ihe ahụ maka akụrụngwa na akụrụngwa ọ bụla ọzọ.