Skip to content

Styles: renaming a custom color causing the color to disappear across the site #50232

Closed

Description

@tiennguyenvan

Description

I thought it is OK for users to change the name of the colors they defined in the global color palette because, sometimes, users may make typos or simply want to rename colors for clarity. However, with the current WordPress FSE, changing the name of a custom color will also change its corresponding CSS variable which causes the color to disappear from all elements across the site.

As shown in the first screenshot, a custom color name 'Color 1' is used as the border color of the group, the color of the title, and the background color of the submit button.
custom-color-01

But when changing this 'Color 1' to 'Danger Color', the color disappears from all the elements mentioned above.
custom-color-02

Proposed solution

Generating slugs as 'custom-color-1', 'custom-color-2', etc ... for custom color automatically while still allowing users to input custom labels for custom colors at their own will.

Thank you very much.

Activity

  1. added
    Needs Testing
    Global Styles
    [Type] Enhancement
    and removed
    Needs Testing
    on May 2, 2023
  2. ndiego commented on May 2, 2023

    @ndiego
    Member

    I can confirm and have updated the labels accordingly.

  3. added
    [Type] Bug
    on Aug 25, 2026
  4. davewhitley commented on Aug 25, 2026

    @davewhitley
    Contributor

    I can reproduce. I'm changing the label to Bug because from a user pov, this is absolutely unexpected behavior and breaks the site visually.

    To be clear, I would expect the green color to be gone from the site if I deleted the color, but in this case, I am simply renaming the color.

    One possible solution would be to prevent renaming after the color has been created. Restrict the feature so that you can only name the color at the time it is created.

    Beyond that, you should be able to rename it at any time without affecting the site.

    CleanShot.2026-08-25.at.15.54.40.mp4
  5. removed
    [Type] Enhancement
    on Aug 25, 2026
  6. Nyiriland commented on Aug 26, 2026

    @Nyiriland

    One possible solution would be to prevent renaming after the color has been created. Restrict the feature so that you can only name the color at the time it is created.

    Or, likely detach the display name from the variable name. Variable name could stay the same if the colour display name is changed, or use a basic, numbered naming convention like --wp--preset--color--custom-1

  7. changed the title [-]Changing Custom Color Name Breaks the Whole Site[/-] [+]Styles: renaming a custom color causing the color to disappear across the site[/+] on Sep 25, 2026
  8. ramonjd commented on Sep 27, 2026

    @ramonjd
    Member

    Restrict the feature so that you can only name the color at the time it is created.

    This I think is the safest option, good call.

    Reason is, the custom preset might be applied to n unknown blocks around the site. It's better to create a new one, and make deleting them an explicit user decision.

  9. tiennguyenvan commented on Sep 27, 2026

    @tiennguyenvan
    Author

    Restrict the feature so that you can only name the color at the time it is created.

    This I think is the safest option, good call.

    Reason is, the custom preset might be applied to n unknown blocks around the site. It's better to create a new one, and make deleting them an explicit user decision.

    Totally agree. The trade-off is that it will have inferior designing experience compared to Figma.

  10. added
    [Status] In Progress
    on Sep 29, 2026
  11. removed their assignment
    on Sep 29, 2026
  12. ramonjd commented on Sep 29, 2026

    @ramonjd
    Member

    I have a small PR up here:

    It allows renaming a custom colour, gradient or duotone but no longer changes the slug.

    I don't have much time to go more deeply, so if this isn't satisfactory I'll close it.

  13. tiennguyenvan commented on Sep 29, 2026

    @tiennguyenvan
    Author

    Your fix looks great and exactly what I had in mind. Keeping the slug unchanged when renaming the preset avoids the potential side effects. Great des exp.

    Thanks for putting this together, Ramonjd!

  14. annezazu commented on Sep 29, 2026

    @annezazu
    Contributor

    Thank you @ramonjd !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global Styles[Status] In Progress[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions