Skip to content

Commit 92714aa

Browse files
authored
Don't use @wordpress/base-styles package (#68)
1 parent a32b782 commit 92714aa

File tree

4 files changed

+70
-253
lines changed

4 files changed

+70
-253
lines changed

package-lock.json

Lines changed: 0 additions & 250 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"npm": "10.5.0"
2525
},
2626
"devDependencies": {
27-
"@wordpress/base-styles": "5.20.0",
2827
"@wordpress/env": "^10.20.0",
2928
"@wordpress/icons": "^10.20.0",
3029
"@wordpress/scripts": "^30.13.0",

src/admin-schemes.scss

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// These mixins are taken from the WordPress Base Styles package.
2+
// https://github.com/WordPress/gutenberg/blob/trunk/packages/base-styles/_mixins.scss
3+
// There are some small changes to make it work properly with Dart Sass.
4+
5+
@use "sass:color";
6+
7+
@mixin admin-scheme($color-primary) {
8+
// Define RGB equivalents for use in rgba function.
9+
// Hexadecimal css vars do not work in the rgba function.
10+
--wp-admin-theme-color: #{$color-primary};
11+
--wp-admin-theme-color--rgb: #{hex-to-rgb($color-primary)};
12+
// Darker shades.
13+
--wp-admin-theme-color-darker-10: #{color.adjust($color-primary, $lightness: -5%)};
14+
--wp-admin-theme-color-darker-10--rgb: #{hex-to-rgb(color.adjust($color-primary, $lightness: -5%))};
15+
--wp-admin-theme-color-darker-20: #{color.adjust($color-primary, $lightness: -10%)};
16+
--wp-admin-theme-color-darker-20--rgb: #{hex-to-rgb(color.adjust($color-primary, $lightness: -10%))};
17+
18+
// Focus style width.
19+
// Avoid rounding issues by showing a whole 2px for 1x screens, and 1.5px on high resolution screens.
20+
--wp-admin-border-width-focus: 2px;
21+
22+
@media ( -webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
23+
--wp-admin-border-width-focus: 1.5px;
24+
}
25+
}
26+
27+
@mixin wordpress-admin-schemes() {
28+
29+
body.admin-color-light {
30+
31+
@include admin-scheme(#0085ba);
32+
}
33+
34+
body.admin-color-modern {
35+
36+
@include admin-scheme(#3858e9);
37+
}
38+
39+
body.admin-color-blue {
40+
41+
@include admin-scheme(#096484);
42+
}
43+
44+
body.admin-color-coffee {
45+
46+
@include admin-scheme(#46403c);
47+
}
48+
49+
body.admin-color-ectoplasm {
50+
51+
@include admin-scheme(#523f6d);
52+
}
53+
54+
body.admin-color-midnight {
55+
56+
@include admin-scheme(#e14d43);
57+
}
58+
59+
body.admin-color-ocean {
60+
61+
@include admin-scheme(#627c83);
62+
}
63+
64+
body.admin-color-sunrise {
65+
66+
@include admin-scheme(#dd823b);
67+
}
68+
}

src/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@import "~@wordpress/base-styles/mixins";
2-
@include wordpress-admin-schemes();
1+
@use "./admin-schemes" as wp-admin-schemes;
2+
@include wp-admin-schemes.wordpress-admin-schemes();
33

44
$default-scheme-color: #007cba;
55
$border-color: #c3c4c7;

0 commit comments

Comments
 (0)