bricks_update_color
Phase 2BeginnerComplexity: 3/10
Update an existing color in the palette
Overview
Updates an existing color in the Bricks color palette. Only the provided fields are changed — omitted fields remain unchanged. Use this to modify a color’s hex value, name, dark mode variant, CSS variable name, or utility class configuration.
After updating, call bricks_regenerate_assets to recompile CSS with the new color values.
Key Features
Partial update
Only updates the fields you provide — other properties remain unchanged
Dark mode toggle
Add or update the dark_hex value for Bricks 2.2+ dark mode support
When to Use
Changing an existing color's hex value (e.g., adjusting brand colors)
Adding or updating a dark mode hex variant
Renaming a color or changing its CSS variable
Updating utility class configuration for a color
Adding or updating a dark mode hex variant
Renaming a color or changing its CSS variable
Updating utility class configuration for a color
Prerequisites
The color must already exist — get its color_id from bricks_get_color_palette
Run bricks_get_color_palette first to find the color_id
Run bricks_get_color_palette first to find the color_id
When NOT to Use
When creating a new color — use bricks_create_color instead
For bulk color changes — consider deleting and recreating with bricks_create_color_palette
For bulk color changes — consider deleting and recreating with bricks_create_color_palette
Parameters
6 Total Parameters1 Required5 Optional
color_idstringREQUIREDID of the color to update (from bricks_get_color_palette)
namestringoptionalNew display name
hexstringoptionalNew hex color value (light mode)
dark_hexstringoptionalDark mode hex value (Bricks 2.2+)
css_variablestringoptionalNew CSS variable name
utility_classesarrayoptionalUpdated utility class types
Values:
bg, text, border, outline, fill, strokeCode Examples
Update a color hex value
Change the primary color to a new shade
JSON
{
"color_id": "abc123",
"hex": "#3a51de",
"dark_hex": "#6b82f5"
}Response
{"success": true}Tips & Warnings
Tips & Warnings
- Get the
color_idfrombricks_get_color_palettefirst - Only provided fields are updated — omit fields you don’t want to change
- Call
bricks_regenerate_assetsafter updating to recompile CSS
Return Values
Related Tools
Technical Details
Changelog
v1.0
Initial release
20250101