Browse Source

Alves: Add better fallbacks for default colors.

Allan Cole 5 years ago
parent
commit
b458bfad72
2 changed files with 27 additions and 13 deletions
  1. 19 7
      alves/functions.php
  2. 8 6
      alves/style-editor.css

+ 19 - 7
alves/functions.php

@@ -59,10 +59,12 @@ if ( ! function_exists( 'alves_setup' ) ) :
 		 * - if the customizer color is empty, use the default
 		 */
 		$colors_array = get_theme_mod('colors_manager'); // color annotations array()
-		$primary      = ! empty( $colors_array ) ? $colors_array['colors']['link'] : '#3E7D98'; // $config-global--color-primary-default;
-		$secondary    = ! empty( $colors_array ) ? $colors_array['colors']['fg1'] : '#9B6A36';  // $config-global--color-secondary-default;
-		$foreground   = ! empty( $colors_array ) ? $colors_array['colors']['txt'] : '#394d55';  // $config-global--color-foreground-default;
-		$background   = ! empty( $colors_array ) ? $colors_array['colors']['bg'] : '#FFFFFF';   // $config-global--color-background-default;
+		$primary          = ! empty( $colors_array ) ? $colors_array['colors']['link'] : '#3E7D98'; // $config-global--color-primary-default;
+		$secondary        = ! empty( $colors_array ) ? $colors_array['colors']['fg1'] : '#9B6A36';  // $config-global--color-secondary-default;
+		$background       = ! empty( $colors_array ) ? $colors_array['colors']['bg'] : '#FFFFFF';   // $config-global--color-background-default;
+		$foreground       = ! empty( $colors_array ) ? $colors_array['colors']['txt'] : '#394d55';  // $config-global--color-foreground-default;
+		$foreground_light = ! empty( $colors_array ) && $colors_array['colors']['txt'] != '#394d55' ? $colors_array['colors']['txt'] : '#4d6974';  // $config-global--color-foreground-light-default;
+		$foreground_dark  = ! empty( $colors_array ) && $colors_array['colors']['txt'] != '#394d55' ? $colors_array['colors']['txt'] : '#253136';  // $config-global--color-foreground-dark-default;
 
 		// Editor color palette.
 		add_theme_support(
@@ -78,15 +80,25 @@ if ( ! function_exists( 'alves_setup' ) ) :
 					'slug'  => 'secondary',
 					'color' => $secondary,
 				),
+				array(
+					'name'  => __( 'Background', 'alves' ),
+					'slug'  => 'background',
+					'color' => $background,
+				),
 				array(
 					'name'  => __( 'Foreground', 'alves' ),
 					'slug'  => 'foreground',
 					'color' => $foreground,
 				),
 				array(
-					'name'  => __( 'Background', 'alves' ),
-					'slug'  => 'background',
-					'color' => $background,
+					'name'  => __( 'Foreground Light', 'alves' ),
+					'slug'  => 'foreground-light',
+					'color' => $foreground_light,
+				),
+				array(
+					'name'  => __( 'Foreground Dark', 'alves' ),
+					'slug'  => 'foreground-dark',
+					'color' => $foreground_dark,
 				),
 			)
 		);

+ 8 - 6
alves/style-editor.css

@@ -542,17 +542,19 @@ object {
 	background-color: #2f5f74;
 }
 
-.wp-block-button__link.is-style-outline,
-.is-style-outline .wp-block-button__link {
+.wp-block-button__link.is-style-outline:not(.has-text-color),
+.is-style-outline .wp-block-button__link:not(.has-text-color) {
 	color: #3E7D98;
 	background: transparent;
 	border: 2px solid currentcolor;
 }
 
-.wp-block-button__link.is-style-outline:hover, .wp-block-button__link.is-style-outline:focus, .wp-block-button__link.is-style-outline.has-focus,
-.is-style-outline .wp-block-button__link:hover,
-.is-style-outline .wp-block-button__link:focus,
-.is-style-outline .wp-block-button__link.has-focus {
+.wp-block-button__link.is-style-outline:not(.has-text-color):hover,
+.wp-block-button__link.is-style-outline:not(.has-text-color):focus,
+.wp-block-button__link.is-style-outline.has-focus:not(.has-text-color),
+.is-style-outline .wp-block-button__link:not(.has-text-color):hover,
+.is-style-outline .wp-block-button__link:not(.has-text-color):focus,
+.is-style-outline .wp-block-button__link.has-focus:not(.has-text-color) {
 	color: #2f5f74;
 }