mixin with if statments

Solutions on MaxInterview for mixin with if statments by the best coders in the world

showing results for - "mixin with if statments"
Maximilian
20 Oct 2016
1$light-background: #f2ece4;
2$light-text: #036;
3$dark-background: #6b717f;
4$dark-text: #d2e1dd;
5
6@mixin theme-colors($light-theme: true) {
7  @if $light-theme {
8    background-color: $light-background;
9    color: $light-text;
10  } @else {
11    background-color: $dark-background;
12    color: $dark-text;
13  }
14}
15
16.banner {
17  @include theme-colors($light-theme: true);
18  body.dark & {
19    @include theme-colors($light-theme: false);
20  }
21}
22