From c28cb5a99ae7a585623b881a0c76f4c1e3d1aac4 Mon Sep 17 00:00:00 2001 From: CrispyBaguette Date: Wed, 15 Dec 2021 20:31:30 +0100 Subject: [PATCH] More shades: darcula, gray gamma --- client/src/Palette.ts | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/client/src/Palette.ts b/client/src/Palette.ts index d836ff4..9a6c944 100644 --- a/client/src/Palette.ts +++ b/client/src/Palette.ts @@ -3,6 +3,10 @@ class Palette { label: string; constructor(label: string, colors: string[]) { + if (colors.length < 2) { + throw new Error("Palette requires at least two colors."); + } + this.label = label; this.colors = colors; } @@ -51,7 +55,40 @@ const grayScale2bits = new Palette("Gray Scale 2 bits", [ "ffffff", ]); -const palettes = [nord, monokai, grayScale1bit, grayScale2bits]; +const grayScale2bitsGamma = new Palette("Gray, 4 shades, gamma-corrected", [ + "000000", + "888888", + "b6b6b6", + "e0e0e0", +]); + +const darcula = new Palette("Darcula", [ + "000000", + "2B2B2B", + "323232", + "214283", + "555555", + "E74644", + "379C1A", + "5394ec", + "299999", + "808080", + "AE8ABE", + "DCC457", + "A9B7C6", + "EEEEEE", +]); + +const palettes = [ + nord, + monokai, + grayScale1bit, + grayScale2bits, + grayScale2bitsGamma, + darcula, +]; + +palettes.sort((a, b) => a.label.localeCompare(b.label)); export { palettes }; export default Palette;