Skip to main content

Branding Colors

Provide a curated set of brand colors in the editor's color picker so users stay on-brand without memorizing hex codes.

import { useRef } from 'react';
import { PexelizeEditor, PexelizeEditorRef } from '@pexelize/react-editor';

function BrandedColorEditor() {
const editorRef = useRef<PexelizeEditorRef>(null);

return (
<PexelizeEditor
ref={editorRef}
editorKey="pk_your_key"
editorMode="email"
options={{
brandingColors: {
colors: [
{ label: 'Primary', value: '#6366f1' },
{ label: 'Secondary', value: '#ec4899' },
{ label: 'Dark', value: '#1e1b4b' },
{ label: 'Light', value: '#f5f3ff' },
{ label: 'Success', value: '#10b981' },
{ label: 'Warning', value: '#f59e0b' },
],
recentColors: true,
},
}}
/>
);
}

Brand colors appear as a dedicated row of swatches at the top of every color picker in the editor.

Update colors at runtime

// React
editorRef.current?.editor?.setBrandingColors({
colors: [
{ label: 'New Primary', value: '#2563eb' },
{ label: 'New Secondary', value: '#7c3aed' },
],
recentColors: true,
});

// Vanilla JS
pexelize.setBrandingColors({
colors: [
{ label: 'New Primary', value: '#2563eb' },
{ label: 'New Secondary', value: '#7c3aed' },
],
});
Recent colors

Set recentColors: true to show a "Recently used" row below the brand colors. This tracks the last 8 colors the user selected during the session.

Color format

Colors must be 6-digit hex values (e.g., #6366f1). The label is shown as a tooltip when hovering over the swatch.

Method reference

MethodReturnsDescription
setBrandingColors(config)voidReplace brand color palette at runtime

Next steps