|
@@ -53,40 +53,41 @@ if ( ! function_exists( 'alves_setup' ) ) :
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- // Add child theme editor color pallete to match Sass-map variables in `_config-child-theme-deep.scss`.
|
|
|
+ /*
|
|
|
+ * Get customizer colors and add them to the editor color palettes
|
|
|
+ *
|
|
|
+ * - if the customizer color is empty, use the default
|
|
|
+ */
|
|
|
+ $colors_array = get_theme_mod('colors_manager'); // color annotations array()
|
|
|
+ $background = $colors_array['colors']['bg']; // $config-global--color-background-default;
|
|
|
+ $primary = $colors_array['colors']['link']; // $config-global--color-primary-default;
|
|
|
+ $foreground = $colors_array['colors']['txt']; // $config-global--color-foreground-default;
|
|
|
+ $secondary = $colors_array['colors']['fg1']; // $config-global--color-secondary-default;
|
|
|
+
|
|
|
+ // Editor color palette.
|
|
|
add_theme_support(
|
|
|
'editor-color-palette',
|
|
|
array(
|
|
|
array(
|
|
|
'name' => __( 'Primary', 'alves' ),
|
|
|
'slug' => 'primary',
|
|
|
- 'color' => '#3E7D98',
|
|
|
+ 'color' => ! isset($primary) ? '#3E7D98' : $primary,
|
|
|
),
|
|
|
array(
|
|
|
'name' => __( 'Secondary', 'alves' ),
|
|
|
'slug' => 'secondary',
|
|
|
- 'color' => '#9B6A36',
|
|
|
+ 'color' => ! isset($secondary) ? '#9B6A36' : $secondary,
|
|
|
),
|
|
|
array(
|
|
|
- 'name' => __( 'Dark Gray', 'alves' ),
|
|
|
- 'slug' => 'foreground-dark',
|
|
|
- 'color' => '#253136',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'name' => __( 'Gray', 'alves' ),
|
|
|
+ 'name' => __( 'Foreground', 'alves' ),
|
|
|
'slug' => 'foreground',
|
|
|
- 'color' => '#394d55',
|
|
|
+ 'color' => ! isset($foreground) ? '#394d55' : $foreground,
|
|
|
),
|
|
|
array(
|
|
|
- 'name' => __( 'Light Gray', 'alves' ),
|
|
|
- 'slug' => 'foreground-light',
|
|
|
- 'color' => '#4d6974',
|
|
|
+ 'name' => __( 'Background', 'alves' ),
|
|
|
+ 'slug' => 'background',
|
|
|
+ 'color' => ! isset($background) ? '#ffffff' : $background,
|
|
|
),
|
|
|
- array(
|
|
|
- 'name' => __( 'White', 'alves' ),
|
|
|
- 'slug' => 'background',
|
|
|
- 'color' => '#ffffff',
|
|
|
- ),
|
|
|
)
|
|
|
);
|
|
|
}
|