diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 8a12f231200542..848f00a8e270be 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -88,6 +88,10 @@
- `NumberControl`: Replace `hideHTMLArrows` prop with `spinControls` prop. Allow custom spin controls via `spinControls="custom"` ([#45333](https://github.com/WordPress/gutenberg/pull/45333)).
+### Experimental
+- Theming: updated Components package to utilize the new `accent` prop of the experimental `Theme` component.
+
+
## 21.3.0 (2022-10-19)
### Bug Fix
diff --git a/packages/components/src/angle-picker-control/index.js b/packages/components/src/angle-picker-control/index.js
index 67b8bfb4cff9c4..654b58b943756c 100644
--- a/packages/components/src/angle-picker-control/index.js
+++ b/packages/components/src/angle-picker-control/index.js
@@ -19,6 +19,7 @@ import { Root } from './styles/angle-picker-control-styles';
import { space } from '../ui/utils/space';
import { Text } from '../text';
import { Spacer } from '../spacer';
+import { COLORS } from '../utils/colors-values';
export default function AnglePickerControl( {
/** Start opting into the new margin-free styles that will become the default in a future version. */
@@ -70,7 +71,7 @@ export default function AnglePickerControl( {
marginBottom={ 0 }
marginRight={ space( 3 ) }
style={ {
- color: 'var( --wp-admin-theme-color )',
+ color: COLORS.ui.theme,
} }
>
°
diff --git a/packages/components/src/autocomplete/style.scss b/packages/components/src/autocomplete/style.scss
index 4b8434caacf45a..4d04b3b8b52cf2 100644
--- a/packages/components/src/autocomplete/style.scss
+++ b/packages/components/src/autocomplete/style.scss
@@ -11,6 +11,6 @@
width: 100%;
&.is-selected {
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
}
}
diff --git a/packages/components/src/base-field/test/__snapshots__/index.js.snap b/packages/components/src/base-field/test/__snapshots__/index.js.snap
index f35321afdb0555..273234b79c1f9a 100644
--- a/packages/components/src/base-field/test/__snapshots__/index.js.snap
+++ b/packages/components/src/base-field/test/__snapshots__/index.js.snap
@@ -127,8 +127,8 @@ exports[`base field should render correctly 1`] = `
.emotion-0:focus,
.emotion-0[data-focused='true'] {
- border-color: var( --wp-admin-theme-color, #007cba);
- box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
}
background-color: ${ COLORS.gray[ 400 ] };
`
: css`
- background-color: var( --wp-admin-theme-color );
+ background-color: ${ COLORS.ui.theme };
`;
export const ThumbWrapper = styled.span`
@@ -205,7 +205,7 @@ const thumbFocus = ( { isFocused }: ThumbProps ) => {
&::before {
content: ' ';
position: absolute;
- background-color: var( --wp-admin-theme-color );
+ background-color: ${ COLORS.ui.theme };
opacity: 0.4;
border-radius: 50%;
height: ${ thumbSize + 8 }px;
diff --git a/packages/components/src/resizable-box/style.scss b/packages/components/src/resizable-box/style.scss
index feca32387d2e49..6badc505b799a6 100644
--- a/packages/components/src/resizable-box/style.scss
+++ b/packages/components/src/resizable-box/style.scss
@@ -35,7 +35,7 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
top: calc(50% - #{ceil($resize-handler-size * 0.5)});
right: calc(50% - #{ceil($resize-handler-size * 0.5)});
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
// Only visible in Windows High Contrast mode.
outline: 2px solid transparent;
}
@@ -47,7 +47,7 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
content: "";
width: 3px;
height: 3px;
- background: var(--wp-admin-theme-color);
+ background: $components-color-accent;
cursor: inherit;
position: absolute;
top: calc(50% - 1px);
diff --git a/packages/components/src/search-control/style.scss b/packages/components/src/search-control/style.scss
index 36a51316401cb9..ddd9d0e5b06e3b 100644
--- a/packages/components/src/search-control/style.scss
+++ b/packages/components/src/search-control/style.scss
@@ -18,7 +18,7 @@
&:focus {
background: $white;
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
}
&::placeholder {
diff --git a/packages/components/src/snackbar/style.scss b/packages/components/src/snackbar/style.scss
index 74d786133f11a4..0e54d3b432b939 100644
--- a/packages/components/src/snackbar/style.scss
+++ b/packages/components/src/snackbar/style.scss
@@ -22,7 +22,7 @@
&:focus {
box-shadow:
0 0 0 1px $white,
- 0 0 0 3px var(--wp-admin-theme-color);
+ 0 0 0 3px $components-color-accent;
}
&.components-snackbar-explicit-dismiss {
@@ -64,7 +64,7 @@
}
&:hover {
- color: var(--wp-admin-theme-color);
+ color: $components-color-accent;
}
}
}
diff --git a/packages/components/src/spinner/styles.ts b/packages/components/src/spinner/styles.ts
index 2f1101e1254c88..7a5a2205c97dd9 100644
--- a/packages/components/src/spinner/styles.ts
+++ b/packages/components/src/spinner/styles.ts
@@ -24,7 +24,7 @@ export const StyledSpinner = styled.svg`
display: inline-block;
margin: 5px 11px 0;
position: relative;
- color: var( --wp-admin-theme-color );
+ color: ${ COLORS.ui.theme };
overflow: visible;
`;
diff --git a/packages/components/src/tab-panel/style.scss b/packages/components/src/tab-panel/style.scss
index 74e3aa2a48379a..6a796b93015771 100644
--- a/packages/components/src/tab-panel/style.scss
+++ b/packages/components/src/tab-panel/style.scss
@@ -33,13 +33,12 @@
}
&:focus:not(:disabled) {
- box-shadow: inset 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ box-shadow: inset 0 var(--wp-admin-border-width-focus) $components-color-accent;
}
-
&.is-active {
// The transparent shadow ensures no jumpiness when focus animates on an active tab.
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 0 -$border-width-tab 0 0 var(--wp-admin-theme-color);
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 0 -$border-width-tab 0 0 $components-color-accent;
position: relative;
// This border appears in Windows High Contrast mode instead of the box-shadow.
@@ -55,10 +54,10 @@
}
&:focus {
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
}
&.is-active:focus {
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -#{$border-width-tab * 2} 0 0 var(--wp-admin-theme-color);
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent, inset 0 -#{$border-width-tab * 2} 0 0 $components-color-accent;
}
}
diff --git a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap
index e8284a4fde11ef..be5b20d593954c 100644
--- a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap
+++ b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap
@@ -65,8 +65,8 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
}
.emotion-8:focus-within {
- border-color: var( --wp-admin-theme-color-darker-10, #006ba1);
- box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
+ border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline: none;
z-index: 1;
}
@@ -400,8 +400,8 @@ exports[`ToggleGroupControl should render correctly with text options 1`] = `
}
.emotion-8:focus-within {
- border-color: var( --wp-admin-theme-color-darker-10, #006ba1);
- box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba);
+ border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline: none;
z-index: 1;
}
diff --git a/packages/components/src/tools-panel/styles.ts b/packages/components/src/tools-panel/styles.ts
index f76bf47ec18c5b..85ad1cb278d9b0 100644
--- a/packages/components/src/tools-panel/styles.ts
+++ b/packages/components/src/tools-panel/styles.ts
@@ -148,7 +148,7 @@ export const DropdownMenu = css`
`;
export const ResetLabel = styled.span`
- color: var( --wp-admin-theme-color-darker-10 );
+ color: ${ COLORS.ui.themeDark10 };
font-size: 11px;
font-weight: 500;
line-height: 1.4;
diff --git a/packages/components/src/utils/colors-values.js b/packages/components/src/utils/colors-values.js
index f3cf21ccb54969..0055168a003fb1 100644
--- a/packages/components/src/utils/colors-values.js
+++ b/packages/components/src/utils/colors-values.js
@@ -31,12 +31,14 @@ const ALERT = {
// Matches @wordpress/base-styles
const ADMIN = {
- theme: 'var( --wp-admin-theme-color, #007cba)',
- themeDark10: 'var( --wp-admin-theme-color-darker-10, #006ba1)',
+ theme: 'var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba))',
+ themeDark10:
+ 'var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1))',
};
const UI = {
theme: ADMIN.theme,
+ themeDark10: ADMIN.themeDark10,
background: white,
backgroundDisabled: GRAY[ 100 ],
border: GRAY[ 700 ],
diff --git a/packages/components/src/utils/input/base.js b/packages/components/src/utils/input/base.js
index 2b4657d47e3b5d..2c5010fc92737c 100644
--- a/packages/components/src/utils/input/base.js
+++ b/packages/components/src/utils/input/base.js
@@ -19,10 +19,10 @@ export const inputStyleNeutral = css`
`;
export const inputStyleFocus = css`
- border-color: var( --wp-admin-theme-color );
+ border-color: ${ COLORS.ui.theme };
box-shadow: 0 0 0
calc( ${ CONFIG.borderWidthFocus } - ${ CONFIG.borderWidth } )
- var( --wp-admin-theme-color );
+ ${ COLORS.ui.theme };
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
diff --git a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap
index 12be60e7ffe44b..f9f7be89c82a0c 100644
--- a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap
+++ b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap
@@ -580,13 +580,13 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
}
.emotion-13:hover {
- color: var( --wp-admin-theme-color, #007cba);
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
}
.emotion-13:focus {
background-color: transparent;
- color: var( --wp-admin-theme-color, #007cba);
- border-color: var( --wp-admin-theme-color, #007cba);
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline: 3px solid transparent;
}
diff --git a/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap b/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap
index 6382e8dd68ae57..bdae729fd61490 100644
--- a/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap
+++ b/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap
@@ -609,7 +609,7 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
display: inline-block;
margin: 5px 11px 0;
position: relative;
- color: var( --wp-admin-theme-color );
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
overflow: visible;
}