From 3ef7a7a07eae67239f4ae932a6d992b799aa70d8 Mon Sep 17 00:00:00 2001 From: Dallas Hoffman Date: Sat, 23 Sep 2023 16:20:31 -0400 Subject: [PATCH] Add setting for default note color --- .../components/notes/note-color-picker.svelte | 8 +- .../settings/settings-color-picker.svelte | 78 +++++++++++++++++++ .../components/settings/settings-modal.svelte | 8 +- src/lib/db/enums/note-color.ts | 4 + 4 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 src/lib/components/settings/settings-color-picker.svelte diff --git a/src/lib/components/notes/note-color-picker.svelte b/src/lib/components/notes/note-color-picker.svelte index ee24ae7..727f479 100644 --- a/src/lib/components/notes/note-color-picker.svelte +++ b/src/lib/components/notes/note-color-picker.svelte @@ -1,6 +1,6 @@ + +
+ {#each NoteColorArray as [color, colorData] (color)} +
+ + {#if value === color} +
+
+ +
+
+ {/if} +
+ {/each} +
+ + diff --git a/src/lib/components/settings/settings-modal.svelte b/src/lib/components/settings/settings-modal.svelte index a49eb87..9b30079 100644 --- a/src/lib/components/settings/settings-modal.svelte +++ b/src/lib/components/settings/settings-modal.svelte @@ -1,8 +1,9 @@ @@ -17,5 +18,8 @@ bind:value={$noteScale} /> - +
+ Default Note Color + +
diff --git a/src/lib/db/enums/note-color.ts b/src/lib/db/enums/note-color.ts index b746c15..31ef3fa 100644 --- a/src/lib/db/enums/note-color.ts +++ b/src/lib/db/enums/note-color.ts @@ -30,3 +30,7 @@ export const NoteColor = { DARK: 'hsl(0, 0%, 85%)', }, } as const; + +export const NoteColorArray = Object.entries(NoteColor) as [ + [keyof typeof NoteColor, (typeof NoteColor)[keyof typeof NoteColor]] +];