diff --git a/apps/client/src/menus/custom-items/NoteColorPickerMenuItem.tsx b/apps/client/src/menus/custom-items/NoteColorPickerMenuItem.tsx index 3d0b5e7fd..60757aa15 100644 --- a/apps/client/src/menus/custom-items/NoteColorPickerMenuItem.tsx +++ b/apps/client/src/menus/custom-items/NoteColorPickerMenuItem.tsx @@ -4,7 +4,7 @@ import attributes from "../../services/attributes"; import FNote from "../../entities/fnote"; import froca from "../../services/froca"; -const COLORS = ["blue", "green", "cyan", "red", "magenta", "brown", "yellow", ""]; +const COLORS = ["blue", "green", "cyan", "red", "magenta", "brown", "yellow", null]; export interface NoteColorPickerMenuItemProps { /** The target Note instance or its ID string. */ @@ -33,17 +33,23 @@ export default function NoteColorPickerMenuItem(props: NoteColorPickerMenuItemPr }, []); useEffect(() => { - setCurrentColor(note?.getLabel("color")?.value ?? ""); + setCurrentColor(note?.getLabel("color")?.value ?? null); }, [note]); - const onColorCellClicked = (color: string) => { + const onColorCellClicked = (color: string | null) => { if (note) { - attributes.setLabel(note.noteId, "color", color); + if (color !== null) { + attributes.setLabel(note.noteId, "color", color); + } else { + attributes.removeOwnedLabelByName(note, "color"); + } + setCurrentColor(color); } } - return