Skip to content

Separator Block: background color defined in theme.json is not applied correctly #43660

Closed

Description

@luminuu

Description

When defining a different background color for the separator block through theme.json or a style variant, the color is not properly displayed.

Through theme.json, only the background-color is defined. To actually change the color, the text color or the border color also has to change. Text color is deactivated in block.json, border controls are not available at the separator block.

Changing the color through the settings in the block editor or site editor adds classes like has-vivid-red-color, which then changes the color. It uses the color CSS property instead of background-color.

Possible solutions:

  • When rendering theme.json, add a CSS property with color or border-color and the defined color
  • Enable text color as setting and remove background color
  • Update separator to use default border controls of Gutenberg

Step-by-step reproduction instructions

  1. Create a style variation of a block theme
  2. Change the color for the separator block through style-variant.json
  3. Check the website and see that the color did not change

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.0.1
  • Gutenberg 13.9
  • Twenty Twenty-Three
  • Custom Style Variation

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. added
    Needs Testing
    [Block] Separator
    on Aug 28, 2022
  2. luminuu commented on Aug 31, 2022

    @luminuu
    MemberAuthor

    The style variation I worked on where I discovered this issue (Figma only atm): WordPress/twentytwentythree#135

  3. moved this from Triage to Todo in WordPress 6.1 Editor Taskson Aug 31, 2022
  4. added
    [Type] Bug
    and removed
    Needs Testing
    on Sep 27, 2022
  5. ndiego commented on Sep 27, 2022

    @ndiego
    Member

    I was able to get a color to show up by setting text color in theme.json. But clearly there are still issues here.

    	"styles": {
    		"blocks": {
    			"core/separator": {
    				"color": {
    					"text": "red",
    					"background": "red"
    				}
    			},
    

    image

  6. ockham commented on Sep 28, 2022

    @ockham
    Contributor

    @c4rl0sbr4v0 @michalczaplinski and I will look into this.

  7. added
    [Status] In Progress
    on Oct 13, 2022
  8. moved this from Todo to Needs Review in WordPress 6.1 Editor Taskson Oct 13, 2022
  9. ockham commented on Oct 17, 2022

    @ockham
    Contributor

    @c4rl0sbr4v0 has filed #44943 to fix this 🙂

  10. moved this from Needs Review to In Progress in WordPress 6.1 Editor Taskson Oct 24, 2022
  11. moved this from In Progress to Bumped to 6.1.1 in WordPress 6.1 Editor Taskson Nov 2, 2022
  12. Repository owner moved this from Bumped to 6.1.1 to Done in WordPress 6.1 Editor Taskson Nov 2, 2022
  13. removed
    [Status] In Progress
    on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Block] Separator[Type] Bug

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions