Maywood: Add Color Annotations

This commit is contained in:
Kjell Reigstad 2020-05-01 09:10:22 -04:00
parent c7b4c3b3ac
commit 4ab5495435
2 changed files with 229 additions and 0 deletions

View file

@ -0,0 +1,208 @@
<?php
/* Custom Colors: Maywood */
// Background Color
// $config-global--color-background-default
add_color_rule( 'bg', '#FFFFFF', 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
// Needs contrast against `link` (primary)
array( '.a8c-posts-list-item__featured span,
.sticky-post,
.wp-block-pullquote.is-style-solid-color,
body .widget_eu_cookie_law_widget #eu-cookie-law.negative', 'color', 'link' ),
/**
* Utility Classes
*/
// Text-color
// Needs contrast against `link` (primary)
array( '.has-primary-background-color[class]', 'color', 'link' ),
// Text-color
// Needs contrast against `fg1` (secondary)
array( '.has-secondary-background-color[class]', 'color', 'fg1' ),
// Text-color
// Needs contrast against `txt` (foreground)
array( '.has-foreground-background-color[class],
.has-foreground-dark-background-color[class],
.has-foreground-light-background-color[class]', 'color', 'txt', 12 ),
// Text-color
// Needs contrast against `txt` (background)
array( '.has-background-color[class],
.has-background-dark-color[class],
.has-background-light-color[class],
.has-background-background-color[class],
.has-background-dark-background-color[class],
.has-background-light-background-color[class]', 'color', 'bg', 12 ),
// 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' ),
), __( 'Background Color' ) );
// Link Color
// $config-global--color-primary-default
add_color_rule( 'link', '#897248', 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"]', 'background-color' ),
// Text-color
// Needs contrast against `bg`
array( '.a8c-posts-list .a8c-posts-list-item__title a:active,
.a8c-posts-list .a8c-posts-list-item__title a:focus,
.a8c-posts-list .a8c-posts-list-item__title a:hover,
.entry-title a:active,
.entry-title a:focus,
.entry-title a:hover,
.main-navigation a:hover,
.page-title a:active,
.page-title a:focus,
.page-title a:hover,
.site-title a:hover,
.social-navigation a:hover,
.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.wp-block-button__link,
.wp-block-button.is-style-outline.wp-block-button__link: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', 'color', 'bg' ),
// Border color left
// Needs contrast against `bg`
array( '.wp-block-quote', 'border-left-color', 'bg' ),
// Border color right
// Needs contrast against `bg`
array( '.wp-block-quote[style*="text-align: right"],
.wp-block-quote[style*="text-align:right"]', 'border-right-color', 'bg' ),
/**
* Utility Classes
*/
// Background-color
array( '.has-primary-background-color[class]', 'background-color' ),
// Text-color
// Needs contrast against `bg`
array( '.has-primary-color[class]', 'color', 'bg' ),
), __( 'Link Color' ) );
// Text Color
// $config-global--color-foreground-default
add_color_rule( 'txt', '#181818', array(
// Text-color
// Needs contrast against `bg` with more contrast
array( '.comment-meta .comment-metadata,
.main-navigation,
.main-navigation a,
.main-navigation a:link,
.main-navigation a:visited,
.screen-reader-text:focus,
.site-title,
.social-navigation a,
.wp-block-code,
.wp-block-code pre,
.wp-block-pullquote,
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', 'bg', 7 ),
// Background-color
// Needs contrast against `bg` with more contrast
array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative', 'background-color', 'bg', 7 ),
/**
* Utility Classes
*/
// Foreground
// Needs contrast against `bg`
array( '.has-foreground-color[class]', 'color', 'bg' ),
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' ),
), __( 'Text Color' ) );
// Accent Color
// $config-global--color-secondary-default
add_color_rule( 'fg1', '#c4493f', array(
/**
* Utility Classes
*/
// Text-color
// Needs contrast against `bg`
array( '.has-secondary-color[class]', 'color', 'bg' ),
// Background-color
array( '.has-secondary-background-color[class]', 'background-color' ),
), __( 'Secondary Color' ) );

21
maywood/inc/wpcom.php Normal file
View file

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