From bc3215e690677724e14cd7a50e373b7bba4a7a93 Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Fri, 1 Nov 2024 23:37:55 +0000 Subject: [PATCH] feat(ansi): add `name` key to `normal` & `bright` objects (#108) --- mod.ts | 5 ++++ palette.json | 64 ++++++++++++++++++++++++++++++++++++++++++ scripts/gen_palette.ts | 2 ++ 3 files changed, 71 insertions(+) diff --git a/mod.ts b/mod.ts index b04110a..446376e 100644 --- a/mod.ts +++ b/mod.ts @@ -242,6 +242,11 @@ export type AnsiColorGroups = Readonly<{ }>; export type AnsiColorFormat = Readonly<{ + /** + * Name of the ANSI group. + */ + name: string; + /** * String-formatted hex value. * @example "#babbf1" diff --git a/palette.json b/palette.json index 8edd3b2..e2c6372 100644 --- a/palette.json +++ b/palette.json @@ -428,10 +428,12 @@ "name": "Black", "order": 0, "normal": { + "name": "Normal", "hex": "#5c5f77", "code": 0 }, "bright": { + "name": "Bright", "hex": "#6c6f85", "code": 8 } @@ -440,10 +442,12 @@ "name": "Red", "order": 1, "normal": { + "name": "Normal", "hex": "#d20f39", "code": 1 }, "bright": { + "name": "Bright", "hex": "#de293e", "code": 9 } @@ -452,10 +456,12 @@ "name": "Green", "order": 2, "normal": { + "name": "Normal", "hex": "#40a02b", "code": 2 }, "bright": { + "name": "Bright", "hex": "#49af3d", "code": 10 } @@ -464,10 +470,12 @@ "name": "Yellow", "order": 3, "normal": { + "name": "Normal", "hex": "#df8e1d", "code": 3 }, "bright": { + "name": "Bright", "hex": "#eea02d", "code": 11 } @@ -476,10 +484,12 @@ "name": "Blue", "order": 4, "normal": { + "name": "Normal", "hex": "#1e66f5", "code": 4 }, "bright": { + "name": "Bright", "hex": "#456eff", "code": 12 } @@ -488,10 +498,12 @@ "name": "Magenta", "order": 5, "normal": { + "name": "Normal", "hex": "#ea76cb", "code": 5 }, "bright": { + "name": "Bright", "hex": "#fe85d8", "code": 13 } @@ -500,10 +512,12 @@ "name": "Cyan", "order": 6, "normal": { + "name": "Normal", "hex": "#179299", "code": 6 }, "bright": { + "name": "Bright", "hex": "#2d9fa8", "code": 14 } @@ -512,10 +526,12 @@ "name": "White", "order": 7, "normal": { + "name": "Normal", "hex": "#acb0be", "code": 7 }, "bright": { + "name": "Bright", "hex": "#bcc0cc", "code": 15 } @@ -950,10 +966,12 @@ "name": "Black", "order": 0, "normal": { + "name": "Normal", "hex": "#51576d", "code": 0 }, "bright": { + "name": "Bright", "hex": "#626880", "code": 8 } @@ -962,10 +980,12 @@ "name": "Red", "order": 1, "normal": { + "name": "Normal", "hex": "#e78284", "code": 1 }, "bright": { + "name": "Bright", "hex": "#e67172", "code": 9 } @@ -974,10 +994,12 @@ "name": "Green", "order": 2, "normal": { + "name": "Normal", "hex": "#a6d189", "code": 2 }, "bright": { + "name": "Bright", "hex": "#8ec772", "code": 10 } @@ -986,10 +1008,12 @@ "name": "Yellow", "order": 3, "normal": { + "name": "Normal", "hex": "#e5c890", "code": 3 }, "bright": { + "name": "Bright", "hex": "#d9ba73", "code": 11 } @@ -998,10 +1022,12 @@ "name": "Blue", "order": 4, "normal": { + "name": "Normal", "hex": "#8caaee", "code": 4 }, "bright": { + "name": "Bright", "hex": "#7b9ef0", "code": 12 } @@ -1010,10 +1036,12 @@ "name": "Magenta", "order": 5, "normal": { + "name": "Normal", "hex": "#f4b8e4", "code": 5 }, "bright": { + "name": "Bright", "hex": "#f2a4db", "code": 13 } @@ -1022,10 +1050,12 @@ "name": "Cyan", "order": 6, "normal": { + "name": "Normal", "hex": "#81c8be", "code": 6 }, "bright": { + "name": "Bright", "hex": "#5abfb5", "code": 14 } @@ -1034,10 +1064,12 @@ "name": "White", "order": 7, "normal": { + "name": "Normal", "hex": "#a5adce", "code": 7 }, "bright": { + "name": "Bright", "hex": "#b5bfe2", "code": 15 } @@ -1472,10 +1504,12 @@ "name": "Black", "order": 0, "normal": { + "name": "Normal", "hex": "#494d64", "code": 0 }, "bright": { + "name": "Bright", "hex": "#5b6078", "code": 8 } @@ -1484,10 +1518,12 @@ "name": "Red", "order": 1, "normal": { + "name": "Normal", "hex": "#ed8796", "code": 1 }, "bright": { + "name": "Bright", "hex": "#ec7486", "code": 9 } @@ -1496,10 +1532,12 @@ "name": "Green", "order": 2, "normal": { + "name": "Normal", "hex": "#a6da95", "code": 2 }, "bright": { + "name": "Bright", "hex": "#8ccf7f", "code": 10 } @@ -1508,10 +1546,12 @@ "name": "Yellow", "order": 3, "normal": { + "name": "Normal", "hex": "#eed49f", "code": 3 }, "bright": { + "name": "Bright", "hex": "#e1c682", "code": 11 } @@ -1520,10 +1560,12 @@ "name": "Blue", "order": 4, "normal": { + "name": "Normal", "hex": "#8aadf4", "code": 4 }, "bright": { + "name": "Bright", "hex": "#78a1f6", "code": 12 } @@ -1532,10 +1574,12 @@ "name": "Magenta", "order": 5, "normal": { + "name": "Normal", "hex": "#f5bde6", "code": 5 }, "bright": { + "name": "Bright", "hex": "#f2a9dd", "code": 13 } @@ -1544,10 +1588,12 @@ "name": "Cyan", "order": 6, "normal": { + "name": "Normal", "hex": "#8bd5ca", "code": 6 }, "bright": { + "name": "Bright", "hex": "#63cbc0", "code": 14 } @@ -1556,10 +1602,12 @@ "name": "White", "order": 7, "normal": { + "name": "Normal", "hex": "#a5adcb", "code": 7 }, "bright": { + "name": "Bright", "hex": "#b8c0e0", "code": 15 } @@ -1994,10 +2042,12 @@ "name": "Black", "order": 0, "normal": { + "name": "Normal", "hex": "#45475a", "code": 0 }, "bright": { + "name": "Bright", "hex": "#585b70", "code": 8 } @@ -2006,10 +2056,12 @@ "name": "Red", "order": 1, "normal": { + "name": "Normal", "hex": "#f38ba8", "code": 1 }, "bright": { + "name": "Bright", "hex": "#f37799", "code": 9 } @@ -2018,10 +2070,12 @@ "name": "Green", "order": 2, "normal": { + "name": "Normal", "hex": "#a6e3a1", "code": 2 }, "bright": { + "name": "Bright", "hex": "#89d88b", "code": 10 } @@ -2030,10 +2084,12 @@ "name": "Yellow", "order": 3, "normal": { + "name": "Normal", "hex": "#f9e2af", "code": 3 }, "bright": { + "name": "Bright", "hex": "#ebd391", "code": 11 } @@ -2042,10 +2098,12 @@ "name": "Blue", "order": 4, "normal": { + "name": "Normal", "hex": "#89b4fa", "code": 4 }, "bright": { + "name": "Bright", "hex": "#74a8fc", "code": 12 } @@ -2054,10 +2112,12 @@ "name": "Magenta", "order": 5, "normal": { + "name": "Normal", "hex": "#f5c2e7", "code": 5 }, "bright": { + "name": "Bright", "hex": "#f2aede", "code": 13 } @@ -2066,10 +2126,12 @@ "name": "Cyan", "order": 6, "normal": { + "name": "Normal", "hex": "#94e2d5", "code": 6 }, "bright": { + "name": "Bright", "hex": "#6bd7ca", "code": 14 } @@ -2078,10 +2140,12 @@ "name": "White", "order": 7, "normal": { + "name": "Normal", "hex": "#a6adc8", "code": 7 }, "bright": { + "name": "Bright", "hex": "#bac2de", "code": 15 } diff --git a/scripts/gen_palette.ts b/scripts/gen_palette.ts index 878caa0..1438545 100644 --- a/scripts/gen_palette.ts +++ b/scripts/gen_palette.ts @@ -325,10 +325,12 @@ const formatted = entriesFromObject(definitions).reduce( name: name[0].toUpperCase() + name.substring(1).toLowerCase(), order: currentIndex, normal: { + name: "Normal", hex: normalColorHex, code: props.normal.code, }, bright: { + name: "Bright", hex: brightColorHex, code: props.bright.code, },