Browse Source

Add dark variants for primary/accent colours in customizer.

pull/125/head
Ned Zimmerman 8 years ago
parent
commit
8745b9d0f6
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 7
      inc/actions/namespace.php
  2. 12
      inc/customizer/namespace.php

7
inc/actions/namespace.php

@ -243,15 +243,8 @@ function add_color_variants( $option, $old_value, $value ) {
$color = Hex::fromString( $value );
$color = $color->toRgb();
$color_alpha = $color->toRgba( 0.25 );
$color_dark = new Rgb(
$color->red() * 0.9,
$color->green() * 0.9,
$color->blue() * 0.9
);
$color_alpha = (string) $color_alpha;
$color_dark = (string) $color_dark;
update_option( $option . '_dark', $color_dark );
update_option( $option . '_alpha', $color_alpha );
}

12
inc/customizer/namespace.php

@ -61,12 +61,24 @@ function customize_register( \WP_Customize_Manager $wp_customize ) {
'label' => __( 'Primary Color', 'pressbooks-aldine' ),
'description' => __( 'Primary color, used for links and other primary elements.', 'pressbooks-aldine' ),
],
[
'slug' => 'primary_dark',
'hex' => '#7f0c07',
'label' => __( 'Primary Color (Dark)', 'pressbooks-aldine' ),
'description' => __( 'Darkened variant of the primary color, used for primary element hover states.', 'pressbooks-aldine' ),
],
[
'slug' => 'accent',
'hex' => '#015d75',
'label' => __( 'Accent Color', 'pressbooks-aldine' ),
'description' => __( 'Accent color, used for flourishes and secondary elements.', 'pressbooks-aldine' ),
],
[
'slug' => 'accent_dark',
'hex' => '#013542',
'label' => __( 'Accent Color (Dark)', 'pressbooks-aldine' ),
'description' => __( 'Darkened variant of the accent color, used for secondary element hover states.', 'pressbooks-aldine' ),
],
[
'slug' => 'primary_fg',
'hex' => '#ffffff',

Loading…
Cancel
Save