Skip to content

Instantly share code, notes, and snippets.

@NicBeltramelli
Last active January 4, 2019 14:31
Show Gist options
  • Save NicBeltramelli/07f0af790ceac6289c9f665a908f8a7f to your computer and use it in GitHub Desktop.
Save NicBeltramelli/07f0af790ceac6289c9f665a908f8a7f to your computer and use it in GitHub Desktop.
Add support for Gutenberg color palette for Genesis Advanced
/* Color Palette */
.has-dark-background-color {
background-color: color(dark, base);
}
.has-dark-color {
color: color(dark, base);
}
.has-white-background-color {
background-color: color(light, soft);
}
.has-white-color {
color: color(light, soft);
}
.has-light-background-color {
background-color: color(light, base);
}
.has-light-color {
color: color(light, base);
}
.has-trans-background-color {
background-color: color(light, trans);
}
.has-trans-color {
color: color(light, trans);
}
.has-accent-background-color {
background-color: color(accent, base);
}
.has-accent-color {
color: color(accent, base);
}
.has-info-background-color {
background-color: color(info, base);
}
.has-info-color {
color: color(info, base);
}
.has-danger-background-color {
background-color: color(danger, base);
}
.has-danger-color {
color: color(danger, base);
}
.has-success-background-color {
background-color: color(success, base);
}
.has-success-color {
color: color(success, base);
}
.has-star-background-color {
background-color: color(star, base);
}
.has-star-color {
color: color(star, base);
}
<?php
// Do NOT include the opening php tag.
/* Add support for Gutenberg editor color palette */
add_theme_support(
'editor-color-palette', [
[
'name' => __( 'Dark', 'genesis-advanced' ),
'slug' => 'dark',
'color' => '#1b1b1b',
],
[
'name' => __( 'White', 'genesis-advanced' ),
'slug' => 'white',
'color' => '#ffffff',
],
[
'name' => __( 'Light', 'genesis-advanced' ),
'slug' => 'light',
'color' => '#e3e3e3',
],
[
'name' => __( 'Trans', 'genesis-advanced' ),
'slug' => 'trans',
'color' => 'rgba(227, 227, 227, 0.4)',
],
[
'name' => __( 'Accent', 'genesis-advanced' ),
'slug' => 'accent',
'color' => get_theme_mod( 'genesis_advanced_accent_color', genesis_advanced_customizer_get_default_accent_color() ),
],
[
'name' => __( 'Info', 'genesis-advanced' ),
'slug' => 'info',
'color' => '#0073e5',
],
[
'name' => __( 'Danger', 'genesis-advanced' ),
'slug' => 'danger',
'color' => '#ed254e',
],
[
'name' => __( 'Success', 'genesis-advanced' ),
'slug' => 'success',
'color' => '#00a878',
],
[
'name' => __( 'Warning', 'genesis-advanced' ),
'slug' => 'warning',
'color' => '#f15025',
],
[
'name' => __( 'Star', 'genesis-advanced' ),
'slug' => 'star',
'color' => '#f2ff49',
],
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment