diff --git a/blocksuite/affine/blocks/callout/src/callout-block.ts b/blocksuite/affine/blocks/callout/src/callout-block.ts index d63ba291ec..3e806ef827 100644 --- a/blocksuite/affine/blocks/callout/src/callout-block.ts +++ b/blocksuite/affine/blocks/callout/src/callout-block.ts @@ -142,7 +142,7 @@ export class CalloutBlockComponent extends CaptionedBlockComponent { + // Map text highlight colors to note background colors + const colorMap: Record< + string, + keyof typeof DefaultTheme.NoteBackgroundColorMap | null + > = { + default: null, + red: 'Red', + orange: 'Orange', + yellow: 'Yellow', + green: 'Green', + teal: 'Green', // Map teal to green as it's not available in NoteBackgroundColorMap + blue: 'Blue', + purple: 'Purple', + grey: 'White', // Map grey to white as it's the closest available + }; + + const mappedColor = colorMap[color]; + const backgroundValue = mappedColor + ? DefaultTheme.NoteBackgroundColorMap[mappedColor] + : null; + ctx.store.updateBlock(model, { background: backgroundValue }); + }; return html` -
+ ${PaletteIcon()} ${EditorChevronDown} + + `} > - ${colors.map( - color => html` - - ` - )} -
+
+
Background
+ ${repeat(colors, color => { + const isDefault = color === 'default'; + const value = isDefault + ? null + : `var(--affine-text-highlight-${color})`; + const displayName = `${color} Background`; + + return html` + updateBackground(color)} + > + + ${displayName} + + `; + })} +
+ `; }, } satisfies ToolbarAction;