瀏覽代碼

Adjust colors.

Kjell Reigstad 4 年之前
父節點
當前提交
e7b5d0657d
共有 2 個文件被更改,包括 43 次插入0 次删除
  1. 39 0
      blank-page/functions.php
  2. 4 0
      blank-page/variables.css

+ 39 - 0
blank-page/functions.php

@@ -23,6 +23,45 @@ if ( ! function_exists( 'blank_page_setup' ) ) :
 
 		// Enqueue editor styles.
 		add_editor_style( 'variables.css' );
+
+		// Editor color palette.
+		$colors_theme_mod = get_theme_mod( 'custom_colors_active' );
+		$primary          = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-primary' ) ) ) ? '#000000' : get_theme_mod( 'seedlet_--global--color-primary' );
+		$secondary        = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-secondary' ) ) ) ? '#007cba' : get_theme_mod( 'seedlet_--global--color-secondary' );
+		$foreground       = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-foreground' ) ) ) ? '#333333' : get_theme_mod( 'seedlet_--global--color-foreground' );
+		$tertiary         = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-tertiary' ) ) ) ? '#FAFAFA' : get_theme_mod( 'seedlet_--global--color-tertiary' );
+		$background       = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-background' ) ) ) ? '#FFFFFF' : get_theme_mod( 'seedlet_--global--color-background' );
+
+		add_theme_support(
+			'editor-color-palette',
+			array(
+				array(
+					'name'  => __( 'Primary', 'blank-page' ),
+					'slug'  => 'primary',
+					'color' => $primary,
+				),
+				array(
+					'name'  => __( 'Secondary', 'blank-page' ),
+					'slug'  => 'secondary',
+					'color' => $secondary,
+				),
+				array(
+					'name'  => __( 'Foreground', 'blank-page' ),
+					'slug'  => 'foreground',
+					'color' => $foreground,
+				),
+				array(
+					'name'  => __( 'Tertiary', 'blank-page' ),
+					'slug'  => 'tertiary',
+					'color' => $tertiary,
+				),
+				array(
+					'name'  => __( 'Background', 'blank-page' ),
+					'slug'  => 'background',
+					'color' => $background,
+				),
+			)
+		);
 	}
 endif;
 add_action( 'after_setup_theme', 'blank_page_setup', 11 );

+ 4 - 0
blank-page/variables.css

@@ -3,4 +3,8 @@
 	/* Font Family */
 	--global--font-primary: var(--font-headings, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif);
 	--global--font-secondary: var(--font-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif);
+	/* Colors */
+	--global--color-secondary: #007cba;
+	--global--color-secondary-hover: #006ba1;
+	--global--color-tertiary: #FAFAFA;
 }