Skip to content

Commit

Permalink
Clarified best practices pertaining to Color Palette values (#15006)
Browse files Browse the repository at this point in the history
* Clarified best practices pertaining to Color Palette values

* Update docs/designers-developers/developers/themes/theme-support.md

@aduth's review

Co-Authored-By: nickylimjj <[email protected]>

* Include explanation for dynamic values
  • Loading branch information
nickylimjj authored and aduth committed May 2, 2019
1 parent 92e73e8 commit 77b8234
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/designers-developers/developers/themes/theme-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ add_theme_support( 'editor-color-palette', array(
) );
```

`name` is a human-readable label (demonstrated above) that appears in the tooltip and provides a meaningful description of the color to users. It is especially important for those who rely on screen readers or would otherwise have difficulty perceiving the color. `slug` is a unique identifier for the color and is used to generate the CSS classes used by the Gutenberg color palette. `color` is the hexadecimal code to specify the color.

Some colors change dynamically — such as "Primary" and "Secondary" color — such as in the Twenty Nineteen theme and cannot be described programmatically. In spite of that, it is still advisable to provide meaningful `name`s for at least the default values when applicable.

The colors will be shown in order on the palette, and there's no limit to how many can be specified.

Themes are responsible for creating the classes that apply the colors in different contexts. Core blocks use "color" and "background-color" contexts. So to correctly apply "strong magenta" to all contexts of core blocks a theme should implement the following classes:
Expand Down

0 comments on commit 77b8234

Please sign in to comment.