-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
44 lines (29 loc) 路 1.15 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pant from "nearest-pantone"
import themes from "./themeparser.js"
import tableify from "./tableify.js"
import markdowngen from "./markdowngen.js"
import comparimage from './image.js'
// import the pantone library and the theme
let pantoneColors = {}
// initialize the pantone color object
// loop through each flavor
// loop through each color
// call the generator.add() function!
for (var key in themes) {
pantoneColors[key] = {}
for (var key2 in themes[key]) {
let hex = themes[key][key2]["hex"];
let themename = key;
let color = key2;
let pantone = pant.getClosestColor(hex)
pantoneColors[themename][color] = { pantone:pantone, hex: hex}
}
}
pantoneColors["mocha"]["crust"] = {hex:"#11111b", pantone:{pantone:"?-7547", hex: "#1A2732", name:"mirage"}}
// set the crust color on mocha, which for some reason doesn't exist in the pantone module i am using
let tables = tableify(pantoneColors)
let latte = markdowngen('latte', tables[0])
let frappe = markdowngen('frappe', tables[1])
let macchiato = markdowngen('macchiato', tables[2])
let mocha = markdowngen("mocha", tables[3])
console.log(latte, frappe, macchiato, mocha)