Newer
Older
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
// eslint-disable-next-line no-console
const log = (...msg: any[]) => console.log(...msg);
async function main() {
const palette: { name: string; hex: string }[] = [
{
name: "White",
hex: "FFFFFF",
},
{
name: "Light Grey",
hex: "C2CBD4",
},
{
name: "Medium Grey",
hex: "858D98",
},
{
name: "Deep Grey",
hex: "4B4F58",
},
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
name: "Black",
hex: "000000",
},
{
name: "Dark Chocolate",
hex: "38271D",
},
{
name: "Chocolate",
hex: "6C422C",
},
{
name: "Brown",
hex: "BC7541",
},
{
name: "Peach",
hex: "FFB27F",
},
{
name: "Beige",
hex: "FFD68F",
},
{
name: "Pink",
hex: "FEB2D9",
},
{
name: "Magenta",
hex: "F854CF",
},
{
name: "Mauve",
hex: "C785F3",
},
{
name: "Purple",
hex: "9C29BC",
},
{
name: "Dark Purple",
hex: "562972",
},
{
name: "Navy",
hex: "1E1E5B",
},
{
name: "Blue",
hex: "153FA2",
},
{
name: "Azure",
hex: "1C95DF",
},
{
name: "Aqua",
hex: "A0E8FF",
},
{
name: "Light Teal",
hex: "17A8A3",
},
{
name: "Dark Teal",
hex: "226677",
},
{
name: "Forest",
hex: "094C45",
},
{
name: "Dark Green",
hex: "278242",
},
{
name: "Green",
hex: "43C91E",
},
{
name: "Lime",
hex: "B7F954",
},
{
name: "Pastel Yellow",
hex: "FFFFAF",
},
{
name: "Yellow",
hex: "FAE70F",
},
{
name: "Orange",
hex: "FEA815",
},
{
name: "Rust",
hex: "EA5B15",
},
{
name: "Maroon",
hex: "5A0400",
},
{
name: "Rose",
hex: "990700",
},
{
name: "Red",
hex: "D81515",
},
{
name: "Watermelon",
hex: "FF635E",
},
];
for (const { name, hex } of palette) {
log("Ensuring color", { name, hex });
await prisma.paletteColor.upsert({
where: { hex },
update: {},
create: {
name,
hex,
},
});
}
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
// eslint-disable-next-line no-console
console.error(e);
await prisma.$disconnect();
process.exit(1);
});