28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// The colours a note, a folder or an entry row can be given, and shown as swatches in the
|
|
// sidebar's colour menus. The list lives here because every campaign section colours its
|
|
// rows the same way; nothing in it talks to the API or holds state.
|
|
const ENTRY_COLORS = [
|
|
{ name: 'Red', value: '#e74c3c' },
|
|
{ name: 'Orange', value: '#e67e22' },
|
|
{ name: 'Yellow', value: '#f1c40f' },
|
|
{ name: 'Green', value: '#2ecc71' },
|
|
{ name: 'Teal', value: '#1abc9c' },
|
|
{ name: 'Blue', value: '#3498db' },
|
|
{ name: 'Purple', value: '#9b59b6' },
|
|
{ name: 'Pink', value: '#fd79a8' }
|
|
];
|
|
|
|
// The 'Color' submenu: one swatch per preset colour, and a way back to no colour at all.
|
|
// `pick` is called with the colour, or null for the default.
|
|
function BuildColorMenu(pick, { defaultLabel = 'Default' } = {}) {
|
|
const items = ENTRY_COLORS.map((color) => ({
|
|
name: color.name, color: color.value, action: () => pick(color.value)
|
|
}));
|
|
|
|
items.push({ divider: true });
|
|
items.push({ name: defaultLabel, icon: '/icons/iconoir/regular/xmark-circle.svg', action: () => pick(null) });
|
|
return items;
|
|
}
|
|
|
|
export { ENTRY_COLORS, BuildColorMenu };
|