Skip to content

Commit f920f2d

Browse files
authored
Build: using a postcss plugin to generate the admin-schemes styles (#6739)
* Try using a post-css plugin to generate the admin-schemes styles * Add browserlist config * Use postCSS color-function to avoid having to declare darkened colors as theme colors * Fix postcss-themes packages.json indentation * Fix the form toggle colors * Add publishConfig to the package.json of postcss-themes * Fix date picker theme colors * Fix toggle colors * Adding a unit test * Fix sass code style (adding spaces) * Fix unit tests
1 parent ca2b3d3 commit f920f2d

File tree

30 files changed

+407
-143
lines changed

30 files changed

+407
-143
lines changed

.browserslistrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extends @wordpress/browserslist-config

components/button/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
&.button-primary.is-busy[disabled] {
3535
color: $white !important;
3636
background-size: 100px 100% !important;
37-
background-image: linear-gradient( -45deg, $blue-medium-500 28%, $blue-dark-900 28%, $blue-dark-900 72%, $blue-medium-500 72%) !important;
37+
background-image: linear-gradient( -45deg, theme( primary ) 28%, $blue-dark-900 28%, $blue-dark-900 72%, theme( primary ) 72%) !important;
3838
border-color: $blue-dark-900 !important;
3939
}
4040

components/date-time/style.scss

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
$datepicker__background-color: $light-gray-300;
2-
$datepicker__border-color: $light-gray-500;
3-
$datepicker__highlighted-color: $blue-wordpress;
4-
$datepicker__muted-color: #ccc;
5-
$datepicker__selected-color: $blue-wordpress;
6-
$datepicker__text-color: $dark-gray-500;
7-
$datepicker__header-color: $black;
8-
$datepicker__navigation-disabled-color: lighten($datepicker__muted-color, 10%);
9-
101
$datepicker__border-radius: 0;
112
$datepicker__day-margin: 0.166rem;
123
$datepicker__font-size: 13px;
@@ -16,6 +7,13 @@ $datepicker__margin: 0.4rem;
167
$datepicker__navigation-size: 6px;
178
$datepicker__triangle-size: 6px;
189

10+
$datepicker__background-color: $light-gray-300;
11+
$datepicker__text-color: $dark-gray-500;
12+
$datepicker__header-color: $black;
13+
$datepicker__muted-color: #ccc;
14+
$datepicker__navigation-disabled-color: lighten($datepicker__muted-color, 10%);
15+
$datepicker__border-color: $light-gray-500;
16+
1917
@import '~react-datepicker/src/stylesheets/datepicker';
2018

2119
.react-datepicker__month-container {
@@ -29,7 +27,7 @@ $datepicker__triangle-size: 6px;
2927

3028
.react-datepicker__navigation {
3129
top: 12px;
32-
30+
3331
&--previous,
3432
&--previous:hover {
3533
border-right-color: $black;
@@ -73,3 +71,54 @@ $datepicker__triangle-size: 6px;
7371
transform: translateY(1px);
7472
}
7573
}
74+
75+
// Extending colors to use theme colors
76+
.react-datepicker__time-container {
77+
.react-datepicker__time {
78+
.react-datepicker__time-box {
79+
ul.react-datepicker__time-list {
80+
li.react-datepicker__time-list-item {
81+
&--selected {
82+
background-color: theme( primary );
83+
&:hover {
84+
background-color: theme( primary );
85+
}
86+
}
87+
}
88+
}
89+
}
90+
}
91+
}
92+
93+
.react-datepicker__day {
94+
&--highlighted {
95+
background-color: theme( primary );
96+
&:hover {
97+
background-color: color( theme( primary ) shade(5%) );
98+
}
99+
}
100+
101+
&--selected,
102+
&--in-selecting-range,
103+
&--in-range {
104+
background-color: theme( primary );
105+
&:hover {
106+
background-color: color( theme( primary ) shade(5%) );
107+
}
108+
}
109+
110+
&--keyboard-selected {
111+
background-color: color( theme( primary ) tint(5%) );
112+
&:hover {
113+
background-color: color( theme( primary ) shade(5%) );
114+
}
115+
}
116+
117+
&--in-selecting-range:not(&--in-range) {
118+
background-color: color( theme( primary ) a(50%) );
119+
}
120+
}
121+
122+
.react-datepicker__close-icon::after {
123+
background-color: theme( primary );
124+
}

components/form-toggle/style.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ $toggle-border-width: 2px;
6666

6767
// checked state
6868
&.is-checked .components-form-toggle__track {
69-
background-color: $blue-medium-400;
70-
border: $toggle-border-width solid $blue-medium-400;
69+
background-color: theme( toggle );
70+
border: $toggle-border-width solid theme( toggle );
7171
border: #{ $toggle-height / 2 } solid transparent; // expand the border to fake a solid in Windows High Contrast Mode
7272
}
7373

@@ -83,8 +83,8 @@ $toggle-border-width: 2px;
8383
}
8484

8585
&:before {
86-
background-color: $blue-medium-500;
87-
border: $toggle-border-width solid $blue-medium-500;
86+
background-color: theme( toggle );
87+
border: $toggle-border-width solid theme( toggle );
8888
}
8989
}
9090
}
@@ -119,4 +119,4 @@ $toggle-border-width: 2px;
119119
filter: none;
120120
border: 1px solid $white;
121121
}
122-
}
122+
}

components/form-token-field/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
.components-form-token-field__token-text {
8484
background: transparent;
85-
color: $blue-wordpress;
85+
color: theme( secondary );
8686
}
8787

8888
.components-form-token-field__remove-token {

core-blocks/gallery/editor.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.blocks-gallery-item {
1111

1212
.is-selected {
13-
outline: 4px solid $blue-medium-500;
13+
outline: 4px solid theme( primary );
1414
outline-offset: -4px;
1515
}
1616

@@ -67,7 +67,7 @@
6767
position: absolute;
6868
top: 0;
6969
right: 0;
70-
background-color: $blue-medium-500;
70+
background-color: theme( primary );
7171
display: inline-flex;
7272
z-index: z-index( '.core-blocks-gallery-item__inline-menu' );
7373

core-blocks/image/editor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
width: 15px !important;
2727
height: 15px !important;
2828
position: absolute;
29-
background: $blue-medium-500;
29+
background: theme( primary );
3030
padding: 0 3px 3px 0;
3131
box-sizing: border-box;
3232
cursor: se-resize;

core-blocks/spacer/editor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
width: 15px !important;
1616
height: 15px !important;
1717
position: absolute;
18-
background: $blue-medium-500;
18+
background: theme( primary );
1919
padding: 0 3px 3px 0;
2020
box-sizing: border-box;
2121
cursor: se-resize;

edit-post/assets/stylesheets/_admin-schemes.scss

Lines changed: 0 additions & 95 deletions
This file was deleted.

edit-post/assets/stylesheets/_colors.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ $white: #fff;
2727

2828
// Additional colors
2929
// some from https://make.wordpress.org/design/handbook/foundations/colors/
30-
$blue-wordpress: #0073aa;
3130
$blue-wordpress-700: #00669b;
3231
$blue-dark-900: #0071a1;
3332

3433
$blue-medium-900: #006589;
3534
$blue-medium-800: #00739C;
3635
$blue-medium-700: #007FAC;
3736
$blue-medium-600: #008DBE;
38-
$blue-medium-500: #00a0d2;
3937
$blue-medium-400: #33B3DB;
4038
$blue-medium-300: #66C6E4;
4139
$blue-medium-200: #BFE7F3;

0 commit comments

Comments
 (0)