Skip to content

Commit f920f2d

Browse files
authored
Build: using a postcss plugin to generate the admin-schemes styles (WordPress#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

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extends @wordpress/browserslist-config

components/button/style.scss

+1-1
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

+59-10
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

+5-5
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

+1-1
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

+2-2
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

+1-1
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

+1-1
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

-95
This file was deleted.

edit-post/assets/stylesheets/_colors.scss

-2
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;

edit-post/assets/stylesheets/main.scss

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
// Output overrides for each scheme
2-
// Almost all schemes use only one color swatch, a few have exceptions to ensure usability
3-
@include admin-scheme-color-overrides( 'fresh', $scheme-fresh__spot-color, $scheme-fresh__spot-color );
4-
@include admin-scheme-color-overrides( 'light', $scheme-light__spot-color, $scheme-light__spot-color );
5-
@include admin-scheme-color-overrides( 'blue', $scheme-blue__spot-color, $scheme-blue__spot-color );
6-
@include admin-scheme-color-overrides( 'coffee', $scheme-coffee__spot-color, $scheme-coffee__spot-color );
7-
@include admin-scheme-color-overrides( 'ectoplasm', $scheme-ectoplasm__spot-color, $scheme-ectoplasm__spot-color );
8-
@include admin-scheme-color-overrides( 'midnight', $scheme-midnight__spot-color, $scheme-midnight__spot-color-2 ); // exception to ensure usability
9-
@include admin-scheme-color-overrides( 'ocean', $scheme-ocean__spot-color, $scheme-ocean__spot-color );
10-
@include admin-scheme-color-overrides( 'sunrise', $scheme-sunrise__spot-color, $scheme-sunrise__spot-color-2 ); // exception to ensure usability
11-
121
// Fade animations
132
@keyframes animate_fade {
143
from {

edit-post/components/sidebar/settings-header/style.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
&.is-active {
2121
padding-bottom: 0;
22-
border-bottom: 3px solid $blue-medium-500;
22+
border-bottom: 3px solid theme( primary );
2323
font-weight: 600;
2424
}
2525

edit-post/components/sidebar/style.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157

158158
&.is-active {
159159
padding-bottom: 0;
160-
border-bottom: 3px solid $blue-medium-500;
160+
border-bottom: 3px solid theme( primary );
161161
font-weight: 600;
162162
}
163163

editor/components/block-drop-zone/style.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
&.is-close-to-bottom {
1111
background: none;
12-
border-bottom: 3px solid $blue-medium-500;
12+
border-bottom: 3px solid theme( primary );
1313
}
1414

1515
&.is-close-to-top,
1616
&.is-appender.is-close-to-top,
1717
&.is-appender.is-close-to-bottom {
1818
background: none;
19-
border-top: 3px solid $blue-medium-500;
19+
border-top: 3px solid theme( primary );
2020
border-bottom: none;
2121
}
2222

editor/components/block-list/style.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@
519519
height: 2px;
520520
left: 0;
521521
right: 0;
522-
background: $blue-medium-500;
522+
background: theme( primary );
523523
}
524524

525525
.editor-block-list__insertion-point-inserter {

editor/components/inserter/style.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ input[type="search"].editor-inserter__search {
202202
&.is-active {
203203
padding-bottom: 8px;
204204
font-weight: 600;
205-
border-bottom: 3px solid $blue-medium-500;
205+
border-bottom: 3px solid theme( primary );
206206
position: relative;
207207
z-index: z-index( '.editor-inserter__tab.is-active' );
208208
}

editor/components/post-featured-image/style.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
.editor-post-featured-image__toggle {
1010
text-decoration: underline;
11-
color: $blue-wordpress;
11+
color: theme( secondary );
1212

1313
&:focus {
1414
box-shadow: none;
1515
outline: none;
1616
}
1717

1818
&:hover {
19-
color: $blue-medium-500;
19+
color: theme( primary );
2020
}
2121
}
2222

editor/components/post-publish-button/style.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
background: none !important;
88
text-decoration: none !important;
99
color: $white !important;
10-
border-color: $blue-wordpress $blue-wordpress-700 $blue-wordpress-700 !important;
10+
border-color: theme( secondary ) $blue-wordpress-700 $blue-wordpress-700 !important;
1111
box-shadow: 0 1px 0 $blue-wordpress-700 !important;
1212
text-shadow: 0 -1px 1px $blue-wordpress-700, 1px 0 1px $blue-wordpress-700, 0 1px 1px $blue-wordpress-700, -1px 0 1px $blue-wordpress-700 !important;
1313
// End of the overriding
@@ -23,7 +23,7 @@
2323
right: 0;
2424
bottom: 0;
2525
content: '';
26-
background-image: repeating-linear-gradient( -45deg, $blue-wordpress-700, $blue-wordpress-700 11px, $blue-wordpress 10px, $blue-wordpress 20px );
26+
background-image: repeating-linear-gradient( -45deg, $blue-wordpress-700, $blue-wordpress-700 11px, theme( secondary ) 10px, theme( secondary ) 20px );
2727
z-index: -1;
2828
@include move_background;
2929
}

0 commit comments

Comments
 (0)