PaletteSwitcher/client/src/Palette.ts

154 lines
2.2 KiB
TypeScript
Raw Normal View History

class Palette {
colors: string[];
label: string;
constructor(label: string, colors: string[]) {
2021-12-15 19:31:30 +00:00
if (colors.length < 2) {
throw new Error("Palette requires at least two colors.");
}
this.label = label;
this.colors = colors;
}
}
const nord = new Palette("Nord", [
"2e3440",
"3b4252",
"434c5e",
"4c566a",
"d8dee9",
"e5e9f0",
"eceff4",
"8fbcbb",
"88c0d0",
"81a1c1",
"5e81ac",
"bf616a",
"d08770",
"ebcb8b",
"a3be8c",
"b48ead",
]);
const monokai = new Palette("Monokai", [
"2e2e2e",
"797979",
"d6d6d6",
"e5b567",
"b4d273",
"e87d3e",
"9e86c8",
"b05279",
"6c99bb",
]);
const grayScale1bit = new Palette("Gray Scale 1 bit (Black & White)", [
"000000",
"ffffff",
]);
const grayScale2bits = new Palette("Gray Scale 2 bits", [
"000000",
"676767",
"b6b6b6",
"ffffff",
]);
2021-12-15 19:31:30 +00:00
const grayScale2bitsGamma = new Palette("Gray, 4 shades, gamma-corrected", [
"000000",
"888888",
"b6b6b6",
"e0e0e0",
]);
2022-04-18 06:43:49 +00:00
// https://draculatheme.com
const dracula = new Palette("Dracula", [
"282a36",
"44475a",
"f8f8f2",
"6272a4",
"8be9fd",
"50fa7b",
"ffb86c",
"ff79c6",
"bd93f9",
"ff5555",
"f1fa8c",
2021-12-15 19:31:30 +00:00
]);
// https://lospec.com/palette-list/ice-cream-gb
const iceCream = new Palette("Ice Cream GB", [
"7c3f58",
"eb6b6f",
"f9a875",
"fff6d3",
]);
// https://lospec.com/palette-list/kirokaze-gameboy
const kirokaze = new Palette("Kirokaze GameBoy", [
"332c50",
"46878f",
"94e344",
"e2f3e4",
]);
2022-11-28 07:07:23 +00:00
const gruvbox = new Palette("Gruvbox", [
"1d2021",
"282828",
"32302f",
"3c3836",
"504945",
"665c54",
"7c6f64",
"7c6f64",
"928374",
"928374",
"f9f5d7",
"fbf1c7",
"f2e5bc",
"ebdbb2",
"d5c4a1",
"bdae93",
"a89984",
"a89984",
"fb4934",
"b8bb26",
"fabd2f",
"83a598",
"d3869b",
"8ec07c",
"fe8019",
"cc241d",
"98971a",
"d79921",
"458588",
"b16286",
"689d6a",
"d65d0e",
"9d0006",
"79740e",
"b57614",
"076678",
"8f3f71",
"427b58",
"af3a03",
]);
2021-12-15 19:31:30 +00:00
const palettes = [
nord,
monokai,
grayScale1bit,
grayScale2bits,
grayScale2bitsGamma,
2022-04-18 06:43:49 +00:00
dracula,
iceCream,
kirokaze,
2022-11-28 07:07:23 +00:00
gruvbox,
2021-12-15 19:31:30 +00:00
];
palettes.sort((a, b) => a.label.localeCompare(b.label));
2021-12-15 17:46:05 +00:00
export { palettes };
export default Palette;