Launi
Bootstrap yana samun goyan bayan babban tsarin launi wanda ke ba da jigogi da salo da abubuwan haɗin mu. Wannan yana ba da damar ingantaccen keɓancewa da haɓakawa ga kowane aiki.
Launukan jigo
Muna amfani da juzu'in duk launuka don ƙirƙirar ƙaramin palette mai launi don samar da tsarin launi, kuma ana samun su azaman masu canjin Sass da taswirar Sass a cikin scss/_variables.scss
fayil ɗin Bootstrap.
Duk waɗannan launuka suna samuwa azaman taswirar Sass, $theme-colors
.
$theme-colors: (
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
);
Duba taswirorin mu na Sass da takaddun madaukai don yadda ake canza waɗannan launuka.
Duk launuka
Duk launukan Bootstrap suna samuwa azaman masu canjin Sass da taswirar Sass a cikin scss/_variables.scss
fayil. Don guje wa ƙara girman girman fayil, ba mu ƙirƙira rubutu ko azuzuwan launi na bango ga kowane ɗayan waɗannan masu canji ba. Madadin haka, mun zaɓi wani yanki na waɗannan launuka don palette mai jigo .
Tabbatar kula da ma'auni na bambanci yayin da kuke keɓance launuka. Kamar yadda aka nuna a ƙasa, mun ƙara bambance-bambancen bambanci guda uku zuwa kowane babban launuka-ɗaya don launukan swatch na yanzu, ɗaya don farar fata, ɗayan kuma don baki.
Bayanan kula akan Sass
Sass ba zai iya samar da masu canji da tsari ba, don haka da hannu muka ƙirƙiri masu canji ga kowane tint da inuwa kan kanmu. Mun ƙididdige ƙimar tsakiyar maki (misali, $blue-500
) kuma muna amfani da ayyukan launi na al'ada don yin tint (haske) ko inuwa (mai duhu) launukanmu ta aikin mix()
launi na Sass.
Amfani mix()
ba iri ɗaya bane da lighten()
kuma darken()
— tsohon yana haɗa ƙayyadaddun launi tare da fari ko baki, yayin da na ƙarshen kawai ke daidaita ƙimar haske na kowane launi. Sakamakon shine ƙarin cikakkun launuka masu yawa, kamar yadda aka nuna a cikin wannan CodePen demo .
Ayyukanmu tint-color()
da ayyukanmu shade-color()
suna amfani da mabambantan mix()
mu $theme-color-interval
, wanda ke ƙayyadad da ƙimar kashi ga kowane gauraye launi da muke samarwa. Duba fayilolin scss/_functions.scss
da scss/_variables.scss
cikakken lambar tushe.
Taswirar Sass Launi
Fayilolin Sass tushen Bootstrap sun haɗa da taswira guda uku don taimaka muku cikin sauri da sauƙi madauki kan jerin launuka da ƙimar hex ɗin su.
$colors
ya lissafa dukkan500
launukan tushe ( ) da muke da su$theme-colors
ya lissafa duk launukan jigo masu suna na ma'ana (wanda aka nuna a ƙasa)$grays
ya lissafa duk tints da inuwar launin toka
A ciki scss/_variables.scss
, zaku sami masu canjin launi na Bootstrap da taswirar Sass. Ga misalin $colors
taswirar 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
);
Ƙara, cire, ko gyara ƙima a cikin taswira don sabunta yadda ake amfani da su a cikin sauran abubuwa da yawa. Abin baƙin ciki a wannan lokacin, ba kowane sashi ke amfani da wannan taswirar Sass ba. Sabuntawa na gaba za su yi ƙoƙarin ingantawa akan wannan. Har sai lokacin, yi shirin yin amfani da masu ${color}
canji da wannan taswirar Sass.
Misali
Ga yadda zaku iya amfani da waɗannan a cikin Sass ɗin ku:
.alpha { color: $purple; }
.beta {
color: $yellow-300;
background-color: $indigo-900;
}
Hakanan ana samun azuzuwan amfanin launi da bangocolor
don saitawa da background-color
amfani da 500
ƙimar launi.