mdb-ui-kit/sass/_mixins-fullpalette.scss

161 lines
6.0 KiB
SCSS
Raw Normal View History

// usage: @include variations(unquote(" .check"), color, transparent);
@mixin variations($extra, $property, $default){
.generic-variations($extra, $default, {
#{$property}: $material-color !default;
});
}
@mixin background-variations($extra, $default){
.generic-variations($extra, $default, {
background-color: $material-color;
& when ($material-color = $btn-default) {
color: $lightbg-text;
}
& when not ($material-color = $btn-default) {
color: $material-text-color;
}
});
}
@mixin text-variations($extra, $default){
.generic-variations($extra, $default, {
color: $material-color;
});
}
//
// To use this mixin you should pass a function as final parameter to define
// the style. In that definition you can use the following variables to define it.
//
// $material-color-name ---> "red", "green", "indigo" ...
// $material-color-full-name ---> "red", "green-50", "indigo-400" ...
// $material-color ---> #f44336, #e8f5e9, #5c6bc0 ...
// $material-text-color ---> rgba(255,255,255,0.84), rgba(0,0,0,0.84), rgba(255,255,255,0.84) ...
//
@mixin generic-variations($extra, $default, $func){
$contrast-factor: 40% !default;
// bootstrap styles
&#{$extra}, &-default#{$extra} {
$material-color-name: "default" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $default !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-black#{$extra} {
$material-color-name: "black" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $black !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-white#{$extra} {
$material-color-name: "white" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $white !default;
$material-text-color: $lightbg-text !default;
$func();
}
&-inverse#{$extra} {
$material-color-name: "inverse" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $inverse !default;
$material-text-color: contrast($inverse, $lightbg-text, $darkbg-text, $contrast-factor) !default;
$func();
}
&-primary#{$extra} {
$material-color-name: "primary" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $primary !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-success#{$extra} {
$material-color-name: "success" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $success !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-info#{$extra} {
$material-color-name: "info" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $info !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-warning#{$extra} {
$material-color-name: "warning" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $warning !default;
$material-text-color: $darkbg-text !default;
$func();
}
&-danger#{$extra} {
$material-color-name: "danger" !default;
$material-color-full-name: $material-color-name !default;
$material-color: $danger !default;
$material-text-color: $darkbg-text !default;
$func();
}
// given a color build multiples dephs
@mixin generic-variations-factory($material-color-name){
// given a color and its deph build css
@mixin generic-variations-factory-deep($material-color-number){
&-material-#{$material-color-name}#{$material-color-number}#{$extra} {
$material-color-full-name: "#{$material-color-name}#{$material-color-number}" !default;
$material-color: $$material-color-full-name !default;
$material-text-color: contrast($material-color, $lightbg-text, $darkbg-text, $contrast-factor) !default;
$func();
}
}
@include generic-variations-factory-deep(unquote(""));
@include generic-variations-factory-deep(unquote("-50"));
@include generic-variations-factory-deep(unquote("-100"));
@include generic-variations-factory-deep(unquote("-200"));
@include generic-variations-factory-deep(unquote("-300"));
@include generic-variations-factory-deep(unquote("-400"));
@include generic-variations-factory-deep(unquote("-500"));
@include generic-variations-factory-deep(unquote("-600"));
@include generic-variations-factory-deep(unquote("-700"));
@include generic-variations-factory-deep(unquote("-800"));
@include generic-variations-factory-deep(unquote("-900"));
@include generic-variations-factory-deep(unquote("-A100"));
@include generic-variations-factory-deep(unquote("-A200"));
@include generic-variations-factory-deep(unquote("-A400"));
@include generic-variations-factory-deep(unquote("-A700"));
}
@include generic-variations-factory(unquote("red"));
@include generic-variations-factory(unquote("pink"));
@include generic-variations-factory(unquote("purple"));
@include generic-variations-factory(unquote("deep-purple"));
@include generic-variations-factory(unquote("indigo"));
@include generic-variations-factory(unquote("blue"));
@include generic-variations-factory(unquote("light-blue"));
@include generic-variations-factory(unquote("cyan"));
@include generic-variations-factory(unquote("teal"));
@include generic-variations-factory(unquote("green"));
@include generic-variations-factory(unquote("light-green"));
@include generic-variations-factory(unquote("lime"));
@include generic-variations-factory(unquote("yellow"));
@include generic-variations-factory(unquote("amber"));
@include generic-variations-factory(unquote("orange"));
@include generic-variations-factory(unquote("deep-orange"));
@include generic-variations-factory(unquote("brown"));
@include generic-variations-factory(unquote("grey"));
@include generic-variations-factory(unquote("blue-grey"));
}
$all-variations: unquote("-default, -primary, -info, -success, -warning, -danger") !default;