Browse Source

Balasana: Fix inconsistent text and link colors inside of group blocks with background colors

- Kudos to @kjellr
Allan Cole 5 năm trước cách đây
mục cha
commit
ace3ce10f5
2 tập tin đã thay đổi với 20 bổ sung2 xóa
  1. 7 1
      balasana/inc/wpcom-colors.php
  2. 13 1
      balasana/inc/wpcom-editor-colors.php

+ 7 - 1
balasana/inc/wpcom-colors.php

@@ -78,7 +78,13 @@ add_color_rule( 'bg', '#FFFFFF', array(
 			.has-background-dark-color,
 			.has-background-light-color,
 			.has-foreground-dark-background-color,
-			.has-foreground-light-background-color', 'color' ),
+			.has-foreground-light-background-color,
+			.has-primary-background-color,
+			.has-primary-background-color.has-background-dim,
+			.has-secondary-background-color,
+			.has-secondary-background-color.has-background-dim,
+			.has-foreground-background-color,
+			.has-foreground-background-color.has-background-dim', 'color' ),
 	// Background-color
 	array( '.has-background-background-color', 'background-color' ),
 	// Background-color darkened

+ 13 - 1
balasana/inc/wpcom-editor-colors.php

@@ -82,7 +82,7 @@ add_editor_color_rule( 'link', '#19744C', array(
 	// Text-color
 	array( '#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
 			#editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color),
-			.editor-styles-wrapper a', 'color' ),
+			#editor .editor-styles-wrapper a', 'color' ),
 
 	// Background-color
 	array( '#editor .editor-styles-wrapper .button,
@@ -172,3 +172,15 @@ add_editor_color_rule( 'fg1', '#BC2213', array(
 			#editor .editor-styles-wrapper .wp-block .has-secondary-background-color', 'background-color' ),
 
 ), __( 'Secondary Color' ) );
+
+
+/**
+  * Custom CSS
+  */
+function balasana_custom_colors_extra_css() { ?>
+	/* Ensure links match the front end when there's a custom background color. */
+	#editor .editor-styles-wrapper .wp-block .has-background:not(.has-background-background-color) a {
+		color: currentColor;
+	}
+<?php }
+add_theme_support( 'custom_colors_extra_css', 'balasana_custom_colors_extra_css' );