Kjell Reigstad 5 lat temu
rodzic
commit
5761de8b61
2 zmienionych plików z 144 dodań i 0 usunięć
  1. 123 0
      brompton/inc/wpcom-colors.php
  2. 21 0
      brompton/inc/wpcom.php

+ 123 - 0
brompton/inc/wpcom-colors.php

@@ -0,0 +1,123 @@
+<?php
+/* Custom Colors: Brompton */
+
+// Background Color
+// $config-global--color-background-default
+add_color_rule( 'bg', 'white', array(
+
+	// Background-color
+	array( '', 'background-color' ),
+
+	// Text-color
+	// Needs contrast against `link` (primary)
+	array( '', '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', '#CA2017', array(
+
+	// Background-color
+	array( '', 'background-color' ),
+
+	// Text-color
+	// Needs contrast against `bg`
+	array( '', 'color', 'bg' ),
+
+	// Border color left
+	// Needs contrast against `bg`
+	array( '', 'border-left-color', 'bg' ),
+
+	// Border color right
+	// Needs contrast against `bg`
+	array( '', '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', '#222222', array(
+
+	// Text-color
+	// Needs contrast against `bg` with more contrast
+	array( '', 'color', 'bg', 7 ),
+
+	// Background-color
+	// Needs contrast against `bg` with more contrast
+	array( '', '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', '#007FDB', 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 - 0
brompton/inc/wpcom.php

@@ -0,0 +1,21 @@
+<?
+/**
+ * Adds support for wp.com-specific theme functions.
+ *
+ * @global array $themecolors
+ */
+function brompton_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', 'brompton_wpcom_setup' );