Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update theme support docs #38514

Merged
merged 3 commits into from
Feb 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions docs/how-to-guides/themes/theme-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,30 @@ Some colors change dynamically — such as "Primary" and "Secondary" color — s

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:
Themes are responsible for creating the classes that apply the colors in different contexts. Core blocks use "color", "background-color", and "border-color" contexts. So to correctly apply "strong magenta" to all contexts of core blocks a theme should implement the classes itself. The class name is built appending 'has-', followed by the class name _using_ kebab case and ending with the context name.

```css
.has-strong-magenta-background-color {
background-color: #313131;
background-color: #a156b4;
}

.has-strong-magenta-color {
color: #f78da7;
color: #a156b4;
}

.has-strong-magenta-border-color {
color: #a156b4;
}
```

The class name is built appending 'has-', followed by the class name _using_ kebab case and ending with the context name.
Starting in WordPress 5.9, to override color values defined by core, themes without a `theme.json` have to set their values via CSS Custom Properties instead of providing the classes. The CSS Custom Properties use the following naming `--wp--preset--color--<slug>`. See more info in [this devnote](https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/). For example:

```css
:root {
--wp--preset--color--cyan-bluish-gray: <new_value>;
--wp--preset--color--pale-pink: <new_value>;
}
```

### Block Gradient Presets

Expand Down Expand Up @@ -198,7 +209,16 @@ Themes are responsible for creating the classes that apply the gradients. So to
}
```

### Block Font Sizes:
Starting in WordPress 5.9, to override gradient values defined by core, themes without a `theme.json` have to set their values via CSS Custom Properties instead of providing the classes. The CSS Custom Properties use the following naming `--wp--preset--gradient--<slug>`. See more info in [this devnote](https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/). For example:

```css
:root {
--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple: <new_value>;
--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan: <new_value>;
}
```

### Block Font Sizes

Blocks may allow the user to configure the font sizes they use, e.g., the paragraph block. The block provides a default set of font sizes, but a theme can overwrite it and provide its own:

Expand Down Expand Up @@ -244,6 +264,15 @@ As an example for the regular font size, a theme may provide the following class
<strong>Note:</strong> The slugs `default` and `custom` are reserved and cannot be used by themes.
</div>

Starting in WordPress 5.9, to override font size values defined by core, themes without a `theme.json` have to set their values via CSS Custom Properties instead of providing the classes. The CSS Custom Properties use the following naming `--wp--preset--font-size--<slug>`. See more info in [this devnote](https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/). For example:

```css
:root {
--wp--preset--font-size--small: <new_value>;
--wp--preset--font-size--large: <new_value>;
}
```

### Disabling custom font sizes

Themes can disable the ability to set custom font sizes with the following code:
Expand Down