From 9d518c20ac07acfe86db9fd9a72e004ccc9bf4ba Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Sun, 10 Mar 2024 20:01:29 -0700 Subject: [PATCH] in progress --- src/components/PalPreview.svelte | 50 +++++++----- src/content-modules/Browse.svelte | 4 +- src/content-modules/Controls.svelte | 12 +-- src/content-modules/MainColumn.svelte | 5 +- src/controls/ColorTagger.svelte | 88 ++++++++++++++++++++++ src/controls/Config.svelte | 5 ++ src/controls/GetColorsFromString.svelte | 17 ++++- src/controls/SuggestColorPal.svelte | 5 ++ src/lib/ColorLint.test.ts | 8 +- src/lib/lint-language/LintLanguage.test.ts | 24 +++++- src/lib/linter-tools/lint-worker.worker.ts | 9 ++- src/lib/utils.ts | 56 ++++++++++---- src/scatterplot/ColorScatterPlot.svelte | 46 ++++++----- src/stores/color-store.ts | 35 +++++++-- src/types.ts | 26 ++++--- 15 files changed, 294 insertions(+), 96 deletions(-) create mode 100644 src/controls/ColorTagger.svelte diff --git a/src/components/PalPreview.svelte b/src/components/PalPreview.svelte index 1fd89fec..0b26325d 100644 --- a/src/components/PalPreview.svelte +++ b/src/components/PalPreview.svelte @@ -4,6 +4,7 @@ export let pal: Palette; export let allowModification: boolean = false; export let highlightSelected: boolean = false; + export let showTags: boolean = false; import { dealWithFocusEvent } from "../lib/utils"; @@ -18,25 +19,34 @@ on:click={() => focusStore.clearColors()} > {#each pal.colors as color, idx} - {#if allowModification} - - {:else} -
- {/if} +
+ {#if allowModification} + + {:else} +
+ {/if} + {#if showTags} +
+ {#each pal.colorSemantics[idx].tags as tag} + {tag} + {/each} +
+ {/if} +
{/each} diff --git a/src/content-modules/Browse.svelte b/src/content-modules/Browse.svelte index 5b6e2f2b..172d5348 100644 --- a/src/content-modules/Browse.svelte +++ b/src/content-modules/Browse.svelte @@ -205,7 +205,9 @@
Colors
-
{pal.palette.colors.map((x) => x.toHex()).join(", ")}
+
+ {pal.palette.colors.map((x) => x.color.toHex()).join(", ")} +
Controls
+
+ {/each} + +
Object for this color
+ + +
Size of color
+ diff --git a/src/controls/Config.svelte b/src/controls/Config.svelte index acd6884d..05534461 100644 --- a/src/controls/Config.svelte +++ b/src/controls/Config.svelte @@ -53,6 +53,11 @@ colors: colors.map((c: string) => Color.colorFromString(c, colorSpace) ), + colorSemantics: colors.map(() => ({ + size: undefined, + markType: undefined, + tags: [], + })), evalConfig: {}, name, type, diff --git a/src/controls/GetColorsFromString.svelte b/src/controls/GetColorsFromString.svelte index 016fa766..135cda3b 100644 --- a/src/controls/GetColorsFromString.svelte +++ b/src/controls/GetColorsFromString.svelte @@ -1,10 +1,12 @@