Skip to content

Commit c9c6892

Browse files
committed
apply color schemes to editor and frontend
1 parent 406ce2a commit c9c6892

File tree

23 files changed

+522
-235
lines changed

23 files changed

+522
-235
lines changed

src/block-components/block-div/edit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ export const Edit = memo( props => {
4848
const { getPlaceholder } = useBlockLayoutDefaults()
4949

5050
const {
51-
COLOR_SCHEME_OPTIONS, backgroundModeColorScheme,
52-
getScheme, updateColorSchemesInUse,
51+
getScheme,
52+
COLOR_SCHEME_OPTIONS,
53+
backgroundModeColorScheme,
5354
} = useBlockColorSchemes()
5455

5556
return (
@@ -94,9 +95,8 @@ export const Edit = memo( props => {
9495
value={ getScheme( backgroundColorScheme || backgroundModeColorScheme, { mode: 'background', returnFallback: false } ) }
9596
options={ COLOR_SCHEME_OPTIONS }
9697
attribute="backgroundColorScheme"
97-
changeCallback={ ( newScheme, oldScheme ) => {
98+
changeCallback={ newScheme => {
9899
const colorScheme = newScheme === backgroundModeColorScheme ? '' : newScheme
99-
updateColorSchemesInUse( colorScheme, oldScheme, 'background' )
100100
return colorScheme
101101
} }
102102
default={ backgroundModeColorScheme }

src/block-components/block-div/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ BlockDiv.Content = props => {
133133
uniqueBlockClass,
134134
{
135135
'stk-block-background': attributes.hasBackground,
136+
[ `background-${ attributes.backgroundColorScheme }` ]: attributes.hasBackground && attributes.backgroundColorScheme,
136137
// When the block has auto top/bottom margins, we need to force the
137138
// parent container to be 100% height or else the auto won't have any
138139
// effect in the frontend. This is okay in the editor-side.

src/block-components/container-div/edit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ export const Edit = props => {
4646
const { getPlaceholder } = useBlockLayoutDefaults()
4747

4848
const {
49-
COLOR_SCHEME_OPTIONS, containerModeColorScheme,
50-
getScheme, updateColorSchemesInUse,
49+
getScheme,
50+
COLOR_SCHEME_OPTIONS,
51+
containerModeColorScheme,
5152
} = useBlockColorSchemes()
5253

5354
return (
@@ -65,9 +66,8 @@ export const Edit = props => {
6566
value={ getScheme( containerColorScheme || containerModeColorScheme, { returnFallback: false } ) }
6667
options={ COLOR_SCHEME_OPTIONS }
6768
attribute="containerColorScheme"
68-
changeCallback={ ( newScheme, oldScheme ) => {
69+
changeCallback={ newScheme => {
6970
const colorScheme = newScheme === containerModeColorScheme ? '' : newScheme
70-
updateColorSchemesInUse( colorScheme, oldScheme )
7171
return colorScheme
7272
} }
7373
default={ containerModeColorScheme }

src/block-components/container-div/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ContainerDiv.Content = props => {
7373
'stk-hover-parent': attributes.hasContainer && attributes.triggerHoverState, // This is needed to trigger parent-hover hover styles.
7474
'stk--no-background': ! attributes.hasContainer,
7575
'stk--no-padding': ! attributes.hasContainer,
76+
[ `container-${ attributes.containerColorScheme }` ]: attributes.hasContainer && attributes.containerColorScheme,
7677
} )
7778

7879
return <Div.Content

src/block/countdown/style.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
.stk-block-countdown__digit {
2828
font-size: 40px;
2929
height: 50%;
30+
color: var(--stk-accent-color);
3031
}
3132

3233
.stk-block-countdown__label,
@@ -39,7 +40,7 @@
3940
align-items: center;
4041
justify-content: center;
4142
.stk-block-countdown__divider-colon {
42-
color: #000;
43+
color: var(--stk-accent-color, #000);
4344
display: flex;
4445
position: relative;
4546
justify-content: center;

src/block/divider/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.stk-block.stk-block-divider {
44
hr.stk-block-divider__hr,
55
.stk-block-divider__dot {
6-
background: #ddd;
6+
background: var(--stk-accent-color, #ddd);
77
}
88
}
99

src/block/icon-list-item/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.stk-block-icon-list-item {
22
list-style-type: none !important;
3+
--stk-icon-list-marker-color: var(--stk-accent-color);
34
}
45
.stk-block-icon-list.stk-block {
56
.wp-block-stackable-icon-list-item:not(:last-child)::after {

src/block/progress-bar/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
border-radius: var(--progress-border-radius, 0);
1212
background-color: var(--progress-background, #f0f0f0);
1313
overflow: hidden;
14+
--progress-color-1: var(--stk-accent-color);
1415
.stk-progress-bar__bar {
1516
// percentage = ( progressValue (%) / progressMax ) * 100
1617
--progress-percent: calc(( var(--progress-value, 50%) / var(--progress-max, 100)) * 100);

src/block/progress-circle/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
position: relative;
55
height: var(--progress-size, 150px);
66
width: var(--progress-size, 150px);
7+
--progress-color-1: var(--stk-accent-color);
78
svg {
89
height: var(--progress-size, 150px);
910
width: var(--progress-size, 150px);

src/block/table-of-contents/style.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@
3737
margin-block-start: 0;
3838
margin-block-end: 0;
3939
}
40+
41+
// Add this so that it inherits the color from global color schemes.
42+
::marker {
43+
color: var(--stk-accent-color);
44+
}
4045
}

0 commit comments

Comments
 (0)