2023-03-08 14:56:11 +00:00
|
|
|
import color from '@k-vyn/coloralgorithm'
|
|
|
|
import colors from './colors.json' assert { type: 'json' }
|
|
|
|
import fs from 'fs'
|
|
|
|
import yaml from 'yaml'
|
|
|
|
|
|
|
|
const offset = 10
|
|
|
|
const palette = {}
|
|
|
|
for (const { properties, options } of colors) {
|
|
|
|
const result = color.generate(properties, options)
|
|
|
|
const name = result[0].name
|
|
|
|
for (const color of result[0].colors) {
|
|
|
|
palette[`${name.toLowerCase()}-${color.step * offset}`] = color.hex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const configFile = '../main.omp.yaml'
|
2023-11-02 23:30:01 +00:00
|
|
|
const config = fs.readFileSync(configFile, 'utf8')
|
2023-03-08 14:56:11 +00:00
|
|
|
// config.palette = palette
|
|
|
|
const output = yaml.stringify({ palette })
|
|
|
|
|
2023-11-02 23:30:01 +00:00
|
|
|
fs.writeFileSync(configFile, config.replace(/palette:(.|\s)*$/, output))
|