Skip to content

Commit 52fa66a

Browse files
authored
简化皮肤配置合并逻辑
1 parent 00a131a commit 52fa66a

3 files changed

Lines changed: 60 additions & 78 deletions

File tree

_sass/minimal-mistakes-plus/skins/_air.scss

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,19 @@ $air-config: map-merge((
1818
@if $air-config {
1919
$config: $air-config;
2020
$primary-color: map-get($config, "primary-color");
21-
@if $primary-color {
22-
@if not map-get($config, "footer-background-color") {
23-
$config: map-merge($config, ("footer-background-color": $primary-color));
24-
}
21+
@if not map-get($config, "footer-background-color") {
22+
$config: map-merge($config, ("footer-background-color": $primary-color));
2523
}
2624

2725
$text-color: map-get($config, "text-color");
28-
@if $text-color {
29-
@if not map-get($config, "masthead-link-color") {
30-
$config: map-merge($config, ("masthead-link-color": $text-color));
31-
}
32-
@if not map-get($config, "masthead-link-color-hover") {
33-
$config: map-merge($config, ("masthead-link-color-hover": $text-color));
34-
}
35-
@if not map-get($config, "navicon-link-color-hover") {
36-
$config: map-merge($config, ("navicon-link-color-hover": mix(#fff, $text-color, 80%)));
37-
}
26+
@if not map-get($config, "masthead-link-color") {
27+
$config: map-merge($config, ("masthead-link-color": $text-color));
28+
}
29+
@if not map-get($config, "masthead-link-color-hover") {
30+
$config: map-merge($config, ("masthead-link-color-hover": $text-color));
31+
}
32+
@if not map-get($config, "navicon-link-color-hover") {
33+
$config: map-merge($config, ("navicon-link-color-hover": mix(#fff, $text-color, 80%)));
3834
}
3935

4036
$configs: map-merge($configs, ("air": $config));

_sass/minimal-mistakes-plus/skins/_aqua.scss

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,69 +21,57 @@ $aqua-config: map-merge((
2121
@if $aqua-config {
2222
$config: $aqua-config;
2323
$gray: map-get($config, "gray");
24-
@if $gray {
25-
@if not map-get($config, "dark-gray") {
26-
$config: map-merge($config, ("dark-gray": mix(#000, $gray, 40%)));
27-
}
28-
@if not map-get($config, "darker-gray") {
29-
$config: map-merge($config, ("darker-gray": mix(#000, $gray, 60%)));
30-
}
31-
@if not map-get($config, "light-gray") {
32-
$config: map-merge($config, ("light-gray": mix(#fff, $gray, 50%)));
33-
}
34-
@if not map-get($config, "lighter-gray") {
35-
$config: map-merge($config, ("lighter-gray": mix(#fff, $gray, 90%)));
36-
}
37-
@if not map-get($config, "primary-color") {
38-
$config: map-merge($config, ("primary-color": $gray));
39-
}
24+
@if not map-get($config, "dark-gray") {
25+
$config: map-merge($config, ("dark-gray": mix(#000, $gray, 40%)));
26+
}
27+
@if not map-get($config, "darker-gray") {
28+
$config: map-merge($config, ("darker-gray": mix(#000, $gray, 60%)));
29+
}
30+
@if not map-get($config, "light-gray") {
31+
$config: map-merge($config, ("light-gray": mix(#fff, $gray, 50%)));
32+
}
33+
@if not map-get($config, "lighter-gray") {
34+
$config: map-merge($config, ("lighter-gray": mix(#fff, $gray, 90%)));
35+
}
36+
@if not map-get($config, "primary-color") {
37+
$config: map-merge($config, ("primary-color": $gray));
4038
}
4139

4240
$lighter-gray: map-get($config, "lighter-gray");
43-
@if $lighter-gray {
44-
@if not map-get($config, "code-background-color") {
45-
$config: map-merge($config, ("code-background-color": $lighter-gray));
46-
}
47-
@if not map-get($config, "border-color") {
48-
$config: map-merge($config, ("border-color": $lighter-gray));
49-
}
41+
@if not map-get($config, "code-background-color") {
42+
$config: map-merge($config, ("code-background-color": $lighter-gray));
43+
}
44+
@if not map-get($config, "border-color") {
45+
$config: map-merge($config, ("border-color": $lighter-gray));
5046
}
5147

5248
$light-gray: map-get($config, "light-gray");
53-
@if $light-gray {
54-
@if not map-get($config, "code-background-color-dark") {
55-
$config: map-merge($config, ("code-background-color-dark": $light-gray));
56-
}
49+
@if not map-get($config, "code-background-color-dark") {
50+
$config: map-merge($config, ("code-background-color-dark": $light-gray));
5751
}
5852

5953
$dark-gray: map-get($config, "dark-gray");
60-
@if $dark-gray {
61-
@if not map-get($config, "text-color") {
62-
$config: map-merge($config, ("text-color": $dark-gray));
63-
}
54+
@if not map-get($config, "text-color") {
55+
$config: map-merge($config, ("text-color": $dark-gray));
6456
}
6557

6658
$info-color: map-get($config, "info-color");
67-
@if $info-color {
68-
@if not map-get($config, "link-color") {
69-
$config: map-merge($config, ("link-color": $info-color));
70-
}
71-
@if not map-get($config, "link-color-hover") {
72-
$config: map-merge($config, ("link-color-hover": mix(#000, $info-color, 25%)));
73-
}
74-
@if not map-get($config, "link-color-visited") {
75-
$config: map-merge($config, ("link-color-visited": mix(#fff, $info-color, 25%)));
76-
}
59+
@if not map-get($config, "link-color") {
60+
$config: map-merge($config, ("link-color": $info-color));
61+
}
62+
@if not map-get($config, "link-color-hover") {
63+
$config: map-merge($config, ("link-color-hover": mix(#000, $info-color, 25%)));
64+
}
65+
@if not map-get($config, "link-color-visited") {
66+
$config: map-merge($config, ("link-color-visited": mix(#fff, $info-color, 25%)));
7767
}
7868

7969
$primary-color: map-get($config, "primary-color");
80-
@if $primary-color {
81-
@if not map-get($config, "masthead-link-color") {
82-
$config: map-merge($config, ("masthead-link-color": $primary-color));
83-
}
84-
@if not map-get($config, "masthead-link-color-hover") {
85-
$config: map-merge($config, ("masthead-link-color-hover": mix(#000, $primary-color, 25%)));
86-
}
70+
@if not map-get($config, "masthead-link-color") {
71+
$config: map-merge($config, ("masthead-link-color": $primary-color));
72+
}
73+
@if not map-get($config, "masthead-link-color-hover") {
74+
$config: map-merge($config, ("masthead-link-color-hover": mix(#000, $primary-color, 25%)));
8775
}
8876

8977
$configs: map-merge($configs, ("aqua": $config));

_sass/minimal-mistakes-plus/skins/_contrast.scss

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ $contrast-config: map-merge((
3333
@if $contrast-config {
3434
$config: $contrast-config;
3535
$text-color: map-get($config, "text-color");
36-
@if $text-color {
37-
@if not map-get($config, "muted-text-color") {
38-
$config: map-merge($config, ("muted-text-color": $text-color));
39-
}
40-
@if not map-get($config, "border-color") {
41-
$config: map-merge($config, ("border-color": mix(#fff, $text-color, 75%)));
42-
}
43-
@if not map-get($config, "masthead-link-color") {
44-
$config: map-merge($config, ("masthead-link-color": $text-color));
45-
}
46-
@if not map-get($config, "masthead-link-color-hover") {
47-
$config: map-merge($config, ("masthead-link-color-hover": $text-color));
48-
}
49-
@if not map-get($config, "navicon-link-color-hover") {
50-
$config: map-merge($config, ("navicon-link-color-hover": mix(#fff, $text-color, 80%)));
51-
}
36+
@if not map-get($config, "muted-text-color") {
37+
$config: map-merge($config, ("muted-text-color": $text-color));
38+
}
39+
@if not map-get($config, "border-color") {
40+
$config: map-merge($config, ("border-color": mix(#fff, $text-color, 75%)));
41+
}
42+
@if not map-get($config, "masthead-link-color") {
43+
$config: map-merge($config, ("masthead-link-color": $text-color));
44+
}
45+
@if not map-get($config, "masthead-link-color-hover") {
46+
$config: map-merge($config, ("masthead-link-color-hover": $text-color));
47+
}
48+
@if not map-get($config, "navicon-link-color-hover") {
49+
$config: map-merge($config, ("navicon-link-color-hover": mix(#fff, $text-color, 80%)));
5250
}
5351

5452
$configs: map-merge($configs, ("contrast": $config));

0 commit comments

Comments
 (0)