Просмотр исходного кода

Redhill: Fix editor-palettes, clean up editor and frontend annotations.

Allan Cole 4 лет назад
Родитель
Сommit
db96dda4dd
3 измененных файлов с 49 добавлено и 51 удалено
  1. 3 23
      redhill/functions.php
  2. 6 5
      redhill/inc/wpcom-colors.php
  3. 40 23
      redhill/inc/wpcom-editor-colors.php

+ 3 - 23
redhill/functions.php

@@ -81,17 +81,12 @@
 				array(
 					'name'  => __( 'Primary', 'redhill' ),
 					'slug'  => 'primary',
-					'color' => '#CA2017',
+					'color' => $primary,
 				),
 				array(
 					'name'  => __( 'Secondary', 'redhill' ),
 					'slug'  => 'secondary',
-					'color' => '#007FDB',
-				),
-				array(
-					'name'  => __( 'Dark Gray', 'redhill' ),
-					'slug'  => 'foreground-dark',
-					'color' => '#111111',
+					'color' => $secondary,
 				),
 				array(
 					'name'  => __( 'Background', 'redhill' ),
@@ -101,22 +96,7 @@
 				array(
 					'name'  => __( 'Foreground', 'redhill' ),
 					'slug'  => 'foreground',
-					'color' => '#444444',
-				),
-				array(
-					'name'  => __( 'Light Gray', 'redhill' ),
-					'slug'  => 'foreground-light',
-					'color' => '#666666',
-				),
-				array(
-					'name'  => __( 'Lighter Gray', 'varia' ),
-					'slug'  => 'background-dark',
-					'color' => '#DDDDDD',
-				),
-				array(
-					'name'  => __( 'Subtle Gray', 'varia' ),
-					'slug'  => 'background-light',
-					'color' => '#FAFAFA',
+					'color' => $foreground,
 				),
 				array(
 					'name'  => __( 'Foreground Light', 'redhill' ),

+ 6 - 5
redhill/inc/wpcom-colors.php

@@ -66,8 +66,7 @@ add_color_rule( 'bg', '#FFFFFF', array(
 			.main-navigation > div > ul > li:hover li > a', 'color' ),
 
 	// Background-color lightened
-	array( '.main-navigation > div,
-			.wp-block-table.is-style-stripes tbody tr:nth-child(odd),
+	array( '.wp-block-table.is-style-stripes tbody tr:nth-child(odd),
 			table.is-style-stripes tbody tr:nth-child(odd)', 'background-color', '+1' ),
 
 	// Border-bottom-color lightened
@@ -251,10 +250,12 @@ add_color_rule( 'link', '#CA2017', array(
 			.site-info a:hover,
 			.site-title a:hover,
 			.social-navigation a,
-			.wp-block-button.is-style-outline,
+			.wp-block-button.is-style-outline.wp-block-button__link, 
 			.wp-block-button.is-style-outline .wp-block-button__link,
-			.wp-block-button.is-style-outline .wp-block-button__link:active,
-			.wp-block-button.is-style-outline:active,
+			.wp-block-button.is-style-outline:not(.has-text-color), 
+			.wp-block-button.is-style-outline:not(.has-text-color):active,
+			.wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color),
+			.wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color):active,
 			.wp-block-newspack-blocks-homepage-articles article .entry-title a,
 			.wp-block-newspack-blocks-homepage-articles article .entry-title a:active,
 			.wp-block-newspack-blocks-homepage-articles article .entry-title a:focus,

+ 40 - 23
redhill/inc/wpcom-editor-colors.php

@@ -11,29 +11,31 @@ add_editor_color_rule( 'bg', '#FFFFFF', array(
 	array( '#editor .editor-styles-wrapper', 'background-color' ),
 
 	// Text-color
-	array( '.button,
-			.button.has-focus,
-			.button:focus,
-			.button:hover,
-			.wp-block-a8c-blog-posts + .button,
-			.wp-block-a8c-blog-posts + .button:focus,
-			.wp-block-a8c-blog-posts + .button:hover,
-			.wp-block-a8c-blog-posts + .has-focus.button,
-			.wp-block-button__link,
-			.wp-block-button__link.has-focus,
-			.wp-block-button__link:focus,
-			.wp-block-button__link:hover,
-			.wp-block-cover,
-			.wp-block-cover-image,
-			.wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
-			.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
-			.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
-			.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
-			.wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
-			.wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
-			.wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
-			.wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
-			.wp-block-pullquote.is-style-solid-color', 'color' ),
+	array( '#editor .editor-styles-wrapper .button,
+			#editor .editor-styles-wrapper .button.has-focus,
+			#editor .editor-styles-wrapper .button:focus,
+			#editor .editor-styles-wrapper .button:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
+			#editor .editor-styles-wrapper .wp-block-button__link,
+			#editor .editor-styles-wrapper .wp-block-button__link.has-focus,
+			#editor .editor-styles-wrapper .wp-block-button__link:focus,
+			#editor .editor-styles-wrapper .wp-block-button__link:hover,
+			#editor .editor-styles-wrapper .wp-block-cover-image,
+			#editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
+			#editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
+			#editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
+			#editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
+			#editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
+			#editor .editor-styles-wrapper .wp-block-cover,
+			#editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
+			#editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
+			#editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
+			#editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
+			#editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
+			#editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color' ),
 
 	// Text-color darkened
 	array( '#editor .editor-styles-wrapper .wp-block-separator.is-style-dots', 'color', '-1' ),
@@ -221,3 +223,18 @@ add_editor_color_rule( 'fg1', '#007FDB', array(
 			#editor .editor-styles-wrapper .wp-block .has-secondary-background-color[class]', 'background-color' ),
 
 ), __( 'Secondary Color' ) );
+
+/**
+ * Custom CSS
+ */
+function redhill_editor_custom_colors_extra_css() { 
+	$colors_array = get_theme_mod( 'colors_manager' );
+	$bg           = $colors_array['colors']['bg'];
+	$txt          = $colors_array['colors']['txt'];
+?>
+	#editor .editor-styles-wrapper .has-background:not(.has-background-background-color) a:not(.wp-block-button__link),
+	#editor .editor-styles-wrapper p.has-text-color a {
+		color: currentColor;
+	}
+<?php }
+add_theme_support( 'custom_colors_extra_css', 'redhill_editor_custom_colors_extra_css' );