Langi
Bootstrap ewagirwa enkola ya langi empanvu ekwata ku sitayiro zaffe n’ebitundu byaffe. Kino kisobozesa okulongoosa n’okugaziya okusingawo ku pulojekiti yonna.
Langi z’omulamwa
Tukozesa ekitundu ekitono ekya langi zonna okukola ekipande kya langi ekitono okukola ensengeka za langi, era nga kisangibwa nga enkyukakyuka za Sass ne maapu ya Sass mu scss/_variables.scss
fayiro ya Bootstrap.
Langi zino zonna zisangibwa nga maapu ya Sass, $theme-colors
.
$theme-colors: (
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
);
Laba Sass maps ne loops docs zaffe omanye engeri y'okukyusaamu langi zino.
Langi zonna
Langi zonna eza Bootstrap zisangibwa nga enkyukakyuka za Sass ne maapu ya Sass mu scss/_variables.scss
fayiro. Okwewala okweyongera mu sayizi za fayiro, tetukola kiraasi za biwandiiko oba langi z’emabega ku buli emu ku nkyukakyuka zino. Mu kifo ky’ekyo, tulonda ekitundu ekitono ekya langi zino ku paleedi y’omulamwa .
Kakasa nti olondoola emigerageranyo gy’enjawulo nga bw’olongoosa langi. Nga bwe kiragibwa wansi, twongeddeko emigerageranyo esatu egy’enjawulo ku buli emu ku langi enkulu —ekimu ku langi za swatch eziriwo kati, ekirala ku njeru, n’endala ku ddugavu.
Ebiwandiiko ku Sass
Sass tesobola kukola programmatically variables, kale twakola manually variables ku buli tint ne shade ffekka. Tulambika omuwendo gw’ensonga ey’omu makkati (okugeza, $blue-500
) era ne tukozesa emirimu gya langi egy’enjawulo okusiiga langi (okutangaaza) oba okusiiga (okuzikiza) langi zaffe nga tuyita mu mulimu gwa mix()
langi ogwa Sass.
Okukozesa mix()
si kye kimu lighten()
ne darken()
—eky’olubereberye kitabula langi eragiddwa n’enjeru oba enjeru, ate eky’oluvannyuma kitereeza omuwendo gw’obutangaavu bwa buli langi yokka. Ekivaamu ye suite ya langi ezijjuvu ennyo, nga bwe kiragibwa mu kino CodePen demo .
Emirimu gyaffe tint-color()
ne shade-color()
gikozesa mix()
ku mabbali g’enkyukakyuka yaffe $theme-color-interval
, eraga omuwendo gw’ebitundu ku kikumi ogw’emitendera ku buli langi etabuddwa gye tufulumya. Laba fayiro scss/_functions.scss
ne scss/_variables.scss
fayiro z'ensibuko enzijuvu.
Maapu za Sass eza langi
Bootstrap's source Sass files zirimu maapu ssatu okukuyamba okutambula amangu era mu ngeri ennyangu ku lukalala lwa langi n'emiwendo gyazo egya hex.
$colors
olukalala lwa langi zaffe zonna eza base (500
) eziriwo$theme-colors
ewandiika langi zonna ez’omulamwa ezituumiddwa amannya mu makulu (eziragiddwa wansi)$grays
awandiika langi zonna n’ebisiikirize eby’enzirugavu
Mu scss/_variables.scss
, ojja kusangamu enkyukakyuka za langi za Bootstrap ne maapu ya Sass. Wano waliwo ekyokulabirako kya $colors
maapu ya 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
);
Okwongera, okuggyawo, oba kyusa emiwendo munda mu maapu okutereeza engeri gye gikozesebwamu mu bitundu ebirala bingi. Ebyembi mu kiseera kino, si buli kitundu nti ekozesa maapu eno eya Sass. Ebipya ebigenda okufulumizibwa mu biseera eby’omu maaso bijja kufuba okulongoosa ku kino. Okutuusa olwo, teekateeka okukozesa ${color}
enkyukakyuka ne maapu eno eya Sass.
Eky'okulabirako
Laba engeri gy'oyinza okukozesaamu bino mu Sass yo:
.alpha { color: $purple; }
.beta {
color: $yellow-300;
background-color: $indigo-900;
}
Ebika by’omugaso gwa langi n’emabega nabyo biriwo okuteeka color
n’okukozesa emiwendo background-color
gya 500
langi.