Ver código fonte

Merge pull request #1951 from Automattic/add/color-anotations-redhill

Redhill: Add Color Annotations
Allan Cole 4 anos atrás
pai
commit
72508bd530

+ 18 - 27
redhill/functions.php

@@ -61,49 +61,40 @@
 			)
 			)
 		);
 		);
 
 
-		// 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()
+		$primary      = ! empty( $colors_array ) ? $colors_array['colors']['link'] : '#CA2017'; // $config-global--color-primary-default;
+		$secondary    = ! empty( $colors_array ) ? $colors_array['colors']['fg1'] : '#007FDB';  // $config-global--color-secondary-default;
+		$foreground   = ! empty( $colors_array ) ? $colors_array['colors']['txt'] : '#444444';  // $config-global--color-foreground-default;
+		$background   = ! empty( $colors_array ) ? $colors_array['colors']['bg'] : '#FFFFFF';   // $config-global--color-background-default;
+
+		// Editor color palette.
 		add_theme_support(
 		add_theme_support(
 			'editor-color-palette',
 			'editor-color-palette',
 			array(
 			array(
 				array(
 				array(
 					'name'  => __( 'Primary', 'redhill' ),
 					'name'  => __( 'Primary', 'redhill' ),
 					'slug'  => 'primary',
 					'slug'  => 'primary',
-					'color' => '#CA2017',
+					'color' => $primary,
 				),
 				),
 				array(
 				array(
 					'name'  => __( 'Secondary', 'redhill' ),
 					'name'  => __( 'Secondary', 'redhill' ),
 					'slug'  => 'secondary',
 					'slug'  => 'secondary',
-					'color' => '#007FDB',
-				),
-				array(
-					'name'  => __( 'Dark Gray', 'redhill' ),
-					'slug'  => 'foreground-dark',
-					'color' => '#111111',
+					'color' => $secondary,
 				),
 				),
 				array(
 				array(
-					'name'  => __( 'Gray', 'redhill' ),
+					'name'  => __( 'Foreground', 'redhill' ),
 					'slug'  => 'foreground',
 					'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(
 				array(
-					'name'  => __( 'White', 'redhill' ),
+					'name'  => __( 'Background', 'redhill' ),
 					'slug'  => 'background',
 					'slug'  => 'background',
-					'color' => '#FFFFFF',
+					'color' => $background,
 				),
 				),
 			)
 			)
 		);
 		);

+ 483 - 0
redhill/inc/wpcom-colors.php

@@ -0,0 +1,483 @@
+<?php
+/* Custom Colors: Redhill */
+
+// Background Color
+// $config-global--color-background-default
+add_color_rule( 'bg', 'white', array(
+
+	// Background-color
+	array( '.screen-reader-text:focus,
+			body,
+			body .widget_eu_cookie_law_widget #eu-cookie-law,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
+			.main-navigation > div > ul > li > .sub-menu', 'background-color' ),
+
+	// Text-color
+	array( '.a8c-posts-list-item__featured span,
+			.a8c-posts-list__view-all,
+			.a8c-posts-list__view-all:focus,
+			.a8c-posts-list__view-all:hover,
+			.button,
+			.button:focus,
+			.button:hover,
+			.sticky-post,
+			.wp-block-button__link,
+			.wp-block-button__link:focus,
+			.wp-block-button__link:hover,
+			.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"]) .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-file .wp-block-file__button,
+			.wp-block-file a.wp-block-file__button:active,
+			.wp-block-file a.wp-block-file__button:focus,
+			.wp-block-file a.wp-block-file__button:hover,
+			.wp-block-file a.wp-block-file__button:visited,
+			.wp-block-file__button,
+			.wp-block-file__button:focus,
+			.wp-block-file__button:hover,
+			.wp-block-gallery .blocks-gallery-image figcaption,
+			.wp-block-gallery .blocks-gallery-item figcaption,
+			.wp-block-pullquote.is-style-solid-color,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
+			button,
+			button.has-focus,
+			button:focus,
+			button:hover,
+			button[data-load-more-btn],
+			input.has-focus[type="submit"],
+			input:focus[type="submit"],
+			input:hover[type="submit"],
+			input[type="submit"],
+			.main-navigation > div > ul > li.current-menu-item > a,
+			.main-navigation > div > ul > li.current-menu-item li > a,
+			.main-navigation > div > ul > li.focus > a,
+			.main-navigation > div > ul > li.focus li > a,
+			.main-navigation > div > ul > li:hover > a,
+			.main-navigation > div > ul > li:hover li > a', 'color' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Text-color
+	array( '.has-primary-background-color[class],
+			.has-secondary-background-color[class],
+			.has-foreground-background-color[class],
+			.has-foreground-dark-background-color[class],
+			.has-foreground-light-background-color[class],
+			.has-background-color[class],
+			.has-background-dark-color[class],
+			.has-background-light-color[class]', 'color' ),
+	// Background-color
+	array( '.has-background-background-color[class]', 'background-color' ),
+	// Background-color darkened
+	array( '.has-background-dark-background-color[class]', 'background-color', '-1' ),
+	// Background-color lightened
+	array( '.has-background-light-background-color[class]', 'background-color', '+1' ),
+
+	/**
+	 * Grays
+	 * Uses a slightly darker color
+	 */
+	// Border-color
+	array( '.wp-block-code,
+			.wp-block-table td,
+			.wp-block-table th,
+			body .widget_eu_cookie_law_widget #eu-cookie-law,
+			input[type="color"],
+			input[type="date"],
+			input[type="datetime"],
+			input[type="datetime-local"],
+			input[type="email"],
+			input[type="month"],
+			input[type="number"],
+			input[type="password"],
+			input[type="range"],
+			input[type="search"],
+			input[type="tel"],
+			input[type="text"],
+			input[type="time"],
+			input[type="url"],
+			input[type="week"],
+			select,
+			table td,
+			table th,
+			textarea,
+			', 'border-color', '-1' ),
+	// Border-top-color
+	array( '.comment-list .children > li,
+			.comment-list > li,
+			.entry-footer,
+			.wp-block-pullquote,
+			#jp-relatedposts h3.jp-relatedposts-headline em:before', 'border-top-color', '-1' ),
+	// Border-bottom-color
+	array( '.comment-list,
+			.wp-block-pullquote,
+			hr,
+			hr.wp-block-separator', 'border-bottom-color', '-1' ),
+	// Color
+	array( 'hr.wp-block-separator.is-style-dots:before', 'color', '-1' ),
+	// Background-color
+	array( '.comments-area:before,
+			.post-navigation:before,
+			.pagination:before,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept.has-focus,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:focus,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:hover', 'background-color', '-1' ),
+
+
+), __( 'Background Color' ) );
+
+// Link Color
+// $config-global--color-primary-default
+add_color_rule( 'link', '#CA2017', array(
+
+	// Background-color
+	array( '.a8c-posts-list-item__featured span,
+			.a8c-posts-list__view-all,
+			.button,
+			.main-navigation #toggle:focus + #toggle-menu,
+			.sticky-post,
+			.wp-block-button__link,
+			.wp-block-file .wp-block-file__button,
+			.wp-block-file__button,
+			.wp-block-pullquote.is-style-solid-color,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
+			button,
+			button[data-load-more-btn],
+			input[type="submit"],
+			.main-navigation > div > ul > li.current-menu-item > a,
+			.main-navigation > div > ul > li.current-menu-item li.current-menu-item > a,
+			.main-navigation > div > ul > li.current-menu-item li.focus > a,
+			.main-navigation > div > ul > li.current-menu-item li:hover > a,
+			.main-navigation > div > ul > li.focus > a,
+			.main-navigation > div > ul > li.focus li.current-menu-item > a,
+			.main-navigation > div > ul > li.focus li.focus > a,
+			.main-navigation > div > ul > li.focus li:hover > a,
+			.main-navigation > div > ul > li:hover > a,
+			.main-navigation > div > ul > li:hover li.current-menu-item > a,
+			.main-navigation > div > ul > li:hover li.focus > a,
+			.main-navigation > div > ul > li:hover li:hover > a', 'background-color' ),
+
+	// Text-color
+	array( '.a8c-posts-list-item__title a:active,
+			.a8c-posts-list-item__title a:focus,
+			.a8c-posts-list-item__title a:hover,
+			.comment-meta .comment-metadata a:active,
+			.comment-meta .comment-metadata a:focus,
+			.comment-meta .comment-metadata a:hover,
+			.comment-navigation a:active,
+			.comment-navigation a:focus,
+			.comment-navigation a:hover,
+			.footer-navigation .footer-menu a:hover,
+			.main-navigation a:hover,
+			.page-title a:active,
+			.page-title a:focus,
+			.page-title a:hover,
+			.pagination .nav-links > *.current,
+			.pagination .nav-links > *:active,
+			.pagination .nav-links > *:focus,
+			.pagination .nav-links > *:hover,
+			.post-navigation a:active,
+			.post-navigation a:focus,
+			.post-navigation a:hover,
+			.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:active,
+			.wp-block-button.is-style-outline: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,
+			.wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
+			a,
+			article .entry-header .entry-title a:active,
+			article .entry-header .entry-title a:focus,
+			article .entry-header .entry-title a:hover', 'color' ),
+
+	// Border color left
+	array( '.wp-block-quote', 'border-left-color' ),
+
+	// Border color right
+	array( '.wp-block-quote[style*="text-align: right"],
+			.wp-block-quote[style*="text-align:right"]', 'border-right-color' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Background-color
+	array( '.has-primary-background-color[class]', 'background-color' ),
+	// Text-color
+	array( '.has-primary-color[class]', 'color' ),
+
+), __( 'Link Color' ) );
+
+// Text Color (Gray)
+// $config-global--color-foreground-default
+add_color_rule( 'txt', '#222222', array(
+
+	// Text-color
+	array( '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
+			.a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
+			.comment-meta .comment-metadata,
+			.comment-meta .comment-metadata a:active,
+			.comment-meta .comment-metadata a:hover,
+			.entry-footer a:active,
+			.entry-footer a:hover,
+			.entry-meta a:active,
+			.entry-meta a:hover,
+			.main-navigation,
+			.main-navigation a,
+			.main-navigation a:link,
+			.main-navigation a:visited,
+			.post-navigation a,
+			.screen-reader-text:focus,
+			.social-navigation a:hover,
+			.wp-block-button.is-style-outline .wp-block-button__link.has-focus,
+			.wp-block-button.is-style-outline .wp-block-button__link:focus,
+			.wp-block-button.is-style-outline .wp-block-button__link:hover,
+			.wp-block-button.is-style-outline.has-focus,
+			.wp-block-button.is-style-outline:focus,
+			.wp-block-button.is-style-outline:hover,
+			.wp-block-code,
+			.wp-block-code pre,
+			.wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
+			.wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
+			.wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
+			.wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
+			.wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
+			.wp-block-pullquote,
+			a:hover,
+			body,
+			body .widget_eu_cookie_law_widget #eu-cookie-law,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
+			input[type="color"],
+			input[type="color"]:focus,
+			input[type="date"],
+			input[type="date"]:focus,
+			input[type="datetime"],
+			input[type="datetime"]:focus,
+			input[type="datetime-local"],
+			input[type="datetime-local"]:focus,
+			input[type="email"],
+			input[type="email"]:focus,
+			input[type="month"],
+			input[type="month"]:focus,
+			input[type="number"],
+			input[type="number"]:focus,
+			input[type="password"],
+			input[type="password"]:focus,
+			input[type="range"],
+			input[type="range"]:focus,
+			input[type="search"],
+			input[type="search"]:focus,
+			input[type="tel"],
+			input[type="tel"]:focus,
+			input[type="text"],
+			input[type="text"]:focus,
+			input[type="time"],
+			input[type="time"]:focus,
+			input[type="url"],
+			input[type="url"]:focus,
+			input[type="week"],
+			input[type="week"]:focus,
+			textarea,
+			textarea:focus', 'color' ),
+
+	// Background-color
+	array( '.a8c-posts-list__view-all:focus,
+			.a8c-posts-list__view-all:hover,
+			.button:focus,
+			.button:hover,
+			.has-focus.a8c-posts-list__view-all,
+			.has-focus.button,
+			.has-focus.wp-block-button__link,
+			.has-focus.wp-block-file__button,
+			.has-foreground-background-color[class],
+			.wp-block-button__link:focus,
+			.wp-block-button__link:hover,
+			.wp-block-cover,
+			.wp-block-cover-image,
+			.wp-block-file__button:focus,
+			.wp-block-file__button:hover,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
+			body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
+			body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
+			button.has-focus,
+			button:focus,
+			button:hover,
+			input.has-focus[type="submit"],
+			input:focus[type="submit"],
+			input:hover[type="submit"],
+			.main-navigation > div > ul > li.current-menu-item li > a,
+			.main-navigation > div > ul > li.focus li > a,
+			.main-navigation > div > ul > li:hover li > a', 'background-color' ),
+
+	// Border-color
+	array( 'input[type="color"]:focus,
+			input[type="date"]:focus,
+			input[type="datetime"]:focus,
+			input[type="datetime-local"]:focus,
+			input[type="email"]:focus,
+			input[type="month"]:focus,
+			input[type="number"]:focus,
+			input[type="password"]:focus,
+			input[type="range"]:focus,
+			input[type="search"]:focus,
+			input[type="tel"]:focus,
+			input[type="text"]:focus,
+			input[type="time"]:focus,
+			input[type="url"]:focus,
+			input[type="week"]:focus,
+			textarea:focus', 'border-color' ),
+
+	// Border-top-color
+	array( '.site', 'border-top-color' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Foreground
+	array( '.has-foreground-color[class],
+			.has-background-background-color[class],
+			.has-background-dark-background-color[class],
+			.has-background-light-background-color[class]', 'color' ),
+	array( '.has-foreground-background-color[class]', 'background-color' ),
+
+	// Text-color darkened
+	array( '.has-foreground-dark-color[class]', 'color', '-1' ),
+	// Background-color darkened
+	array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
+
+	// Text-color brightened
+	array( '.has-foreground-light-color[class]', 'color', '+2' ),
+	// Background-color brightened
+	array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
+
+	/**
+	 * Gray (Same as text color)
+	 */
+	// Text-color
+	array( '.a8c-posts-list__item .a8c-posts-list-item__meta,
+			.comment-meta .comment-metadata,
+			.comment-navigation a,
+			.entry-footer,
+			.entry-meta,
+			.footer-navigation .footer-menu,
+			.has-foreground-light-color[class],
+			.pagination .nav-links > *,
+			.post-navigation .meta-nav,
+			.site-branding,
+			.site-info,
+			.wp-block-image figcaption,
+			.wp-block-latest-comments .wp-block-latest-comments__comment-date,
+			.wp-block-latest-posts .wp-block-latest-posts__post-date,
+			.wp-block-newspack-blocks-homepage-articles article .cat-links,
+			.wp-block-newspack-blocks-homepage-articles article .entry-meta,
+			.wp-block-pullquote .wp-block-pullquote__citation,
+			.wp-block-pullquote cite,
+			.wp-block-pullquote footer,
+			.wp-block-quote .wp-block-quote__citation,
+			.wp-block-quote cite,
+			.wp-block-quote footer,
+			.wp-block-quote.is-large .wp-block-quote__citation,
+			.wp-block-quote.is-large cite,
+			.wp-block-quote.is-large footer,
+			.wp-block-quote.is-style-large .wp-block-quote__citation,
+			.wp-block-quote.is-style-large cite,
+			.wp-block-quote.is-style-large footer,
+			.wp-block-video figcaption,
+			figcaption,
+			.site-title', 'color' ),
+			// Border-color
+			array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative', 'border-color' ),
+
+), __( 'Text Color' ) );
+
+// Accent Color
+// $config-global--color-secondary-default
+add_color_rule( 'fg1', '#007FDB', array(
+
+	/**
+	 * Utility Classes
+	 */
+	// Text-color
+	array( '.has-secondary-color[class]', 'color' ),
+
+	// Background-color
+	array( '.has-secondary-background-color[class]', 'background-color' ),
+
+), __( 'Secondary Color' ) );
+
+/**
+ * Custom CSS
+ */
+function redhill_custom_colors_extra_css() { ?>
+	@media screen and (max-width: 560px) {
+		/* Prevent background color hovers on mobile */
+		.site-header .main-navigation > div,
+		.site-header .main-navigation > div > ul > li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li.current-menu-item li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li.current-menu-item li.focus > a,
+		.site-header .main-navigation > div > ul > li.current-menu-item li:hover > a,
+		.site-header .main-navigation > div > ul > li.focus > a,
+		.site-header .main-navigation > div > ul > li.focus li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li.focus li.focus > a,
+		.site-header .main-navigation > div > ul > li.focus li:hover > a,
+		.site-header .main-navigation > div > ul > li:hover > a,
+		.site-header .main-navigation > div > ul > li:hover li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li:hover li.focus > a,
+		.site-header .main-navigation > div > ul > li:hover li:hover > a,
+		.site-header .main-navigation > div > ul > li:hover li > a {
+			background: transparent;
+			color: inherit;
+		}
+		.site-header .main-navigation > div > ul > li.current-menu-item li.focus > a,
+		.site-header .main-navigation > div > ul > li.current-menu-item li:hover > a,
+		.site-header .main-navigation > div > ul > li.focus > a,
+		.site-header .main-navigation > div > ul > li.focus li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li.focus li.focus > a,
+		.site-header .main-navigation > div > ul > li.focus li:hover > a,
+		.site-header .main-navigation > div > ul > li:hover > a,
+		.site-header .main-navigation > div > ul > li:hover li.current-menu-item > a,
+		.site-header .main-navigation > div > ul > li:hover li.focus > a,
+		.site-header .main-navigation > div > ul > li:hover li:hover > a {
+			text-decoration: underline;
+		}
+	}
+<?php }
+add_theme_support( 'custom_colors_extra_css', 'redhill_custom_colors_extra_css' );
+
+/**
+ * Featured Varia Palettes
+ */
+// Light
+add_color_palette( array(
+	'#FFFFFF',
+	'#1D1E1E',
+	'#C8133E',
+	'#4E2F4B',
+), 'Light' );
+// Medium
+add_color_palette( array(
+	'#EEF4F7',
+	'#242527',
+	'#35845D',
+	'#233252',
+), 'Medium' );
+// Dark
+add_color_palette( array(
+	'#1F2527',
+	'#FFFFFF',
+	'#9FD3E8',
+	'#FBE6AA',
+), 'Dark' );

+ 208 - 0
redhill/inc/wpcom-editor-colors.php

@@ -0,0 +1,208 @@
+<?php
+/*
+ * Custom Editor Colors
+ */
+
+// Background Color
+// $config-global--color-background-default
+add_editor_color_rule( 'bg', 'white', array(
+
+	// Background-color
+	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' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Text-color
+	array( '#editor .editor-styles-wrapper .has-primary-background-color[class],
+			#editor .editor-styles-wrapper .has-secondary-background-color[class],
+			#editor .editor-styles-wrapper .has-foreground-background-color[class],
+			#editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
+			#editor .editor-styles-wrapper .has-foreground-light-background-color[class],
+			#editor .editor-styles-wrapper .has-background-color[class]', 'color' ),
+	// Background-color
+	array( '#editor .editor-styles-wrapper .has-background-background-color[class]', 'background-color' ),
+	// Text-color darkened
+	array( '#editor .editor-styles-wrapper .has-background-dark-color[class]', 'color', '-1'  ),
+	// Background-color darkened
+	array( '#editor .editor-styles-wrapper .has-background-dark-background-color[class]', 'background-color', '-1' ),
+	// Text-color lightened
+	array( '#editor .editor-styles-wrapper .has-background-light-color[class]', 'color', '+1'  ),
+	// Background-color lightened
+	array( '#editor .editor-styles-wrapper .has-background-light-background-color[class]', 'background-color', '+1' ),
+
+	/**
+	 * Grays
+	 * Uses a slightly darker color
+	 */
+	// Color
+	array( '#editor .editor-styles-wrapper .wp-block-separator.is-style-dots', 'color', '-1' ),
+	// Border-color
+	array( '#editor .editor-styles-wrapper .wp-block-code', 'border-color', '-1' ),
+	// Border-top-color
+	array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', '-1' ),
+	// Border-bottom-color
+	array( '#editor .editor-styles-wrapper .wp-block-pullquote,
+			#editor .editor-styles-wrapper .wp-block-separator', 'border-bottom-color', '-1' ),
+
+), __( 'Background Color' ) );
+
+// Link Color
+// $config-global--color-primary-default
+add_editor_color_rule( 'link', '#CA2017', array(
+
+	// Background-color
+	array( '#editor .editor-styles-wrapper .button,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
+			#editor .editor-styles-wrapper .wp-block-button__link,
+			#editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
+
+	// Text-color
+	array( '#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:active,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:focus,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
+			#editor .editor-styles-wrapper .wp-block-button__link.is-style-outline,
+			#editor .editor-styles-wrapper a', 'color' ),
+
+	// Border color left
+	array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
+
+	// Border color right
+	array( '#editor .editor-styles-wrapper .wp-block-quote[style*="text-align: right"],
+			#editor .editor-styles-wrapper .wp-block-quote[style*="text-align:right"]', 'border-right-color' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Background-color
+	array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'background-color' ),
+	// Text-color
+	array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color' ),
+
+), __( 'Link Color' ) );
+
+// Text Color
+// $config-global--color-foreground-default
+add_editor_color_rule( 'txt', '#222222', array(
+
+	// Text-color
+	array( '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input,
+			#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus,
+			#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
+			#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:active,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:active,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:active,
+			#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:hover,
+			#editor .editor-styles-wrapper .wp-block-button__link.is-style-outline.has-focus,
+			#editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:focus,
+			#editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:hover,
+			#editor .editor-styles-wrapper .wp-block-pullquote,
+			#editor .editor-styles-wrapper a:hover,
+			#editor .editor-styles-wrapper', 'color' ),
+
+	// Background-color
+	array( '#editor .editor-styles-wrapper .button.has-focus,
+			#editor .editor-styles-wrapper .button:focus,
+			#editor .editor-styles-wrapper .button:hover,
+			#editor .editor-styles-wrapper .has-foreground-background-color,
+			#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.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,
+			#editor .editor-styles-wrapper .wp-block-cover-image', 'background-color' ),
+
+	/**
+	 * Utility Classes
+	 */
+	// Text-color
+	array( '#editor .editor-styles-wrapper .has-background-background-color[class],
+			#editor .editor-styles-wrapper .has-background-dark-background-color[class],
+			#editor .editor-styles-wrapper .has-background-light-background-color[class],
+			#editor .editor-styles-wrapper .has-foreground-color[class]', 'color' ),
+	// Background-color
+	array( '#editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
+	// Text-color darkened
+	array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
+	// Background-color darkened
+	array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
+	// Text-color brightened
+	array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
+	// Background-color brightened
+	array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
+
+	/**
+	 * Grays
+	 * Same as text color
+	 */
+	// Text-color
+	array( '#editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta,
+			#editor .editor-styles-wrapper .wp-block-image figcaption,
+			#editor .editor-styles-wrapper .wp-block-latest-comments .wp-block-latest-comments__comment-date,
+			#editor .editor-styles-wrapper .wp-block-latest-posts .wp-block-latest-posts__post-date,
+			#editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links,
+			#editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta,
+			#editor .editor-styles-wrapper .wp-block-pullquote .wp-block-pullquote__citation,
+			#editor .editor-styles-wrapper .wp-block-pullquote cite,
+			#editor .editor-styles-wrapper .wp-block-pullquote footer,
+			#editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
+			#editor .editor-styles-wrapper .wp-block-quote cite,
+			#editor .editor-styles-wrapper .wp-block-quote footer,
+			#editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
+			#editor .editor-styles-wrapper .wp-block-quote.is-large cite,
+			#editor .editor-styles-wrapper .wp-block-quote.is-large footer,
+			#editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
+			#editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
+			#editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
+			#editor .editor-styles-wrapper .wp-block-video figcaption,
+			#editor .editor-styles-wrapper figcaption', 'color' ),
+
+), __( 'Text Color' ) );
+
+// Accent Color (Red)
+// $config-global--color-secondary-default
+add_editor_color_rule( 'fg1', '#007FDB', array(
+
+	/**
+	 * Utility Classes
+	 */
+
+	// Text-color
+	array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color' ),
+	// Background-color
+	array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
+
+), __( 'Secondary Color' ) );

+ 21 - 0
redhill/inc/wpcom.php

@@ -0,0 +1,21 @@
+<?
+/**
+ * Adds support for wp.com-specific theme functions.
+ *
+ * @global array $themecolors
+ */
+function redhill_wpcom_setup() {
+	global $themecolors;
+
+	// Set theme colors for third party services.
+	if ( ! isset( $themecolors ) ) {
+		$themecolors = array(
+			'bg'     => 'white', // $config-global--color-background-default
+			'border' => 'DDDDDD', // $config-global--color-border-default
+			'text'   => '222222', // $config-global--color-foreground-default
+			'link'   => 'CA2017', // $config-global--color-primary-default
+			'url'    => 'CA2017', // $config-global--color-primary-default
+		);
+	}
+}
+add_action( 'after_setup_theme', 'redhill_wpcom_setup' );