Compare commits
No commits in common. "1363787086e9e97ce8fe1e384e6e1ce2ded94878" and "8b70f735fc5dc1f3914b0a284b1366c503a59278" have entirely different histories.
1363787086
...
8b70f735fc
22 changed files with 323 additions and 326 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
2
index.ts
2
index.ts
|
@ -6,7 +6,6 @@ import previewSnippet from './src/preview/cli-snippet'
|
|||
import buildTOML from './src/build/toml'
|
||||
import buildYAML from './src/build/yaml'
|
||||
import buildKitty from './ports/kitty/src/build'
|
||||
import buildNeovim from './ports/neovim/src/build'
|
||||
|
||||
const program = new Command();
|
||||
|
||||
|
@ -47,7 +46,6 @@ program
|
|||
|
||||
if (options.verbose) console.info('Building Ports...')
|
||||
log(options.verbose, await buildKitty(), timer)
|
||||
// log(options.verbose, await buildNeovim(), timer)
|
||||
});
|
||||
|
||||
program.parse();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"chalk": "^5.6.2",
|
||||
"color-convert": "^3.1.2",
|
||||
"commander": "^14.0.1",
|
||||
"handlebars": "^4.7.8"
|
||||
"estilo": "^2.1.3",
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
|
|
36
ports/kitty/dist/kitty.conf
vendored
36
ports/kitty/dist/kitty.conf
vendored
|
@ -25,25 +25,6 @@ cursor_trail_color #E1B392
|
|||
url_color #8CC8E0
|
||||
####################
|
||||
|
||||
#########################
|
||||
# window border colors and terminal bell colors
|
||||
active_border_color #23DBC1
|
||||
inactive_border_color #4E6872
|
||||
bell_border_color #FF9F6F
|
||||
# visual_bell_color none
|
||||
####################
|
||||
|
||||
|
||||
#########################
|
||||
# Tab bar colors
|
||||
active_tab_foreground #C6E4F0
|
||||
active_tab_background #19323B
|
||||
inactive_tab_foreground #C6E4F0
|
||||
inactive_tab_background #4E6872
|
||||
# tab_bar_background #00040B
|
||||
# tab_bar_margin_color none
|
||||
####################
|
||||
|
||||
#########################
|
||||
# Marks colors
|
||||
# mark1_foreground black
|
||||
|
@ -54,6 +35,23 @@ inactive_tab_background #4E6872
|
|||
# mark3_background #f274bc
|
||||
####################
|
||||
|
||||
#########################
|
||||
# Tab bar colors
|
||||
active_tab_foreground #C6E4F0
|
||||
active_tab_background #19323B
|
||||
inactive_tab_foreground #C6E4F0
|
||||
inactive_tab_background #4E6872
|
||||
# tab_bar_background #{pit.toHex()}
|
||||
# tab_bar_margin_color none
|
||||
####################
|
||||
|
||||
#########################
|
||||
# window border colors and terminal bell colors
|
||||
active_border_color #23DBC1
|
||||
inactive_border_color #4E6872
|
||||
bell_border_color #FF9F6F
|
||||
# visual_bell_color none
|
||||
####################
|
||||
|
||||
#########################
|
||||
# The basic 16 colors
|
||||
|
|
6
ports/kitty/dist/palette.toml
vendored
Normal file
6
ports/kitty/dist/palette.toml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#########################
|
||||
# verdigris for kitty
|
||||
# 0.0.1
|
||||
# GPL-3.0-only
|
||||
# https://git.basking.monster/gaiety/verdigris
|
||||
####################
|
|
@ -1,3 +1,3 @@
|
|||
import buildKitty from './src/build'
|
||||
import BuildKitty from './src/build'
|
||||
|
||||
await buildKitty()
|
||||
await BuildKitty()
|
||||
|
|
|
@ -1,17 +1,31 @@
|
|||
import appRoot from 'app-root-path'
|
||||
import { renderToFile } from "../../../src/helpers/file"
|
||||
import getData from './data'
|
||||
import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file"
|
||||
import { headerInfo, colorsBasic, colorsURLs, colorsCursor, colorsMarks, colorsTabBar, colorsBordersAndAlerts, colorsBasic16 } from './data'
|
||||
|
||||
const templateFile = appRoot + '/ports/kitty/src/templates/kitty.conf.hbs'
|
||||
const outputFile = appRoot + '/ports/kitty/dist/kitty.conf'
|
||||
const file = appRoot + '/ports/kitty/dist/kitty.conf'
|
||||
|
||||
const appendToKittyConf = async (content: string) => await appendToFile(file, content)
|
||||
|
||||
export default async function(isVerbose = false): Promise<string> {
|
||||
if (isVerbose) console.info('Kitty: Removing previous build', file)
|
||||
try {
|
||||
await renderToFile(templateFile, outputFile, getData(), isVerbose)
|
||||
|
||||
return outputFile
|
||||
await rmFile(file)
|
||||
} catch (error) {
|
||||
throw error
|
||||
console.info('Kitty: Previous build already removed')
|
||||
}
|
||||
if (isVerbose) console.info('Kitty: Ensuring path and file exist', file)
|
||||
await mkFilePath(file)
|
||||
if (isVerbose) console.info('Kitty: Writing header info to file', file)
|
||||
await appendToKittyConf(headerInfo())
|
||||
if (isVerbose) console.info('Kitty: Writing color palette into file', file)
|
||||
await appendToKittyConf(colorsBasic())
|
||||
await appendToKittyConf(colorsCursor())
|
||||
await appendToKittyConf(colorsURLs())
|
||||
await appendToKittyConf(colorsMarks())
|
||||
await appendToKittyConf(colorsTabBar())
|
||||
await appendToKittyConf(colorsBordersAndAlerts())
|
||||
await appendToKittyConf(colorsBasic16())
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,136 @@
|
|||
import { name, version } from '../info.toml'
|
||||
import { license, url } from '../../../package.json'
|
||||
import colors from '../../../src/palette'
|
||||
import type { Colors } from '../../../src/palette'
|
||||
import Color from '../../../src/helpers/color'
|
||||
import {
|
||||
pit,
|
||||
depths,
|
||||
stope,
|
||||
text,
|
||||
orange,
|
||||
teal,
|
||||
red,
|
||||
yellow,
|
||||
green,
|
||||
blue,
|
||||
purple,
|
||||
} from '../../../src/palette'
|
||||
|
||||
export default function(): any {
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
license,
|
||||
url,
|
||||
...flattenColorsToHex(),
|
||||
}
|
||||
export function headerInfo(): string {
|
||||
return `#########################
|
||||
# ${name} for kitty
|
||||
# ${version}
|
||||
# ${license}
|
||||
# ${url}
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
function flattenColorsToHex(): Colors {
|
||||
return colors.reduce((acc, color) => {
|
||||
return {
|
||||
[color.nameSnakeCase]: color.toHex(),
|
||||
...acc,
|
||||
}
|
||||
}, {})
|
||||
export function colorsBasic(): string {
|
||||
return `#########################
|
||||
# The basic colors
|
||||
foreground ${text.toHex()}
|
||||
background ${pit.toHex()}
|
||||
selection_foreground ${depths.toHex()}
|
||||
selection_background ${text.toHex()}
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsCursor(): string {
|
||||
return `#########################
|
||||
# Cursor colors
|
||||
cursor ${text.toHex()}
|
||||
cursor_text_color ${depths.toHex()}
|
||||
cursor_trail_color ${yellow.toHex()}
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsURLs(): string {
|
||||
return `#########################
|
||||
# URL colors
|
||||
url_color ${blue.toHex()}
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsBordersAndAlerts(): string {
|
||||
return `#########################
|
||||
# window border colors and terminal bell colors
|
||||
active_border_color ${teal.toHex()}
|
||||
inactive_border_color ${stope.toHex()}
|
||||
bell_border_color ${orange.toHex()}
|
||||
# visual_bell_color none
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsTabBar(): string {
|
||||
return `#########################
|
||||
# Tab bar colors
|
||||
active_tab_foreground ${text.toHex()}
|
||||
active_tab_background ${depths.toHex()}
|
||||
inactive_tab_foreground ${text.toHex()}
|
||||
inactive_tab_background ${stope.toHex()}
|
||||
# tab_bar_background #{pit.toHex()}
|
||||
# tab_bar_margin_color none
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsMarks(): string {
|
||||
return `#########################
|
||||
# Marks colors
|
||||
# mark1_foreground black
|
||||
# mark1_background #98d3cb
|
||||
# mark2_foreground black
|
||||
# mark2_background #f2dcd3
|
||||
# mark3_foreground black
|
||||
# mark3_background #f274bc
|
||||
####################
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export function colorsBasic16(): string {
|
||||
return `#########################
|
||||
# The basic 16 colors
|
||||
#: black
|
||||
color0 ${pit.toHex()}
|
||||
color8 ${stope.toHex()}
|
||||
|
||||
#: red
|
||||
color1 ${red.toHex()}
|
||||
color9 ${red.toHex()}
|
||||
|
||||
#: green
|
||||
color2 ${green.toHex()}
|
||||
color10 ${green.toHex()}
|
||||
|
||||
#: yellow
|
||||
color3 ${yellow.toHex()}
|
||||
color11 ${yellow.toHex()}
|
||||
|
||||
#: blue
|
||||
color4 ${blue.toHex()}
|
||||
color12 ${blue.toHex()}
|
||||
|
||||
#: magenta
|
||||
color5 ${purple.toHex()}
|
||||
color13 ${purple.toHex()}
|
||||
|
||||
#: cyan
|
||||
color6 ${teal.toHex()}
|
||||
color14 ${teal.toHex()}
|
||||
|
||||
#: white
|
||||
color7 ${text.toHex()}
|
||||
color15 ${text.toHex()}
|
||||
####################`
|
||||
}
|
||||
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#########################
|
||||
# {{name}} for kitty
|
||||
# {{version}}
|
||||
# {{license}}
|
||||
# {{url}}
|
||||
####################
|
||||
|
||||
#########################
|
||||
# The basic colors
|
||||
foreground {{text}}
|
||||
background {{pit}}
|
||||
selection_foreground {{depths}}
|
||||
selection_background {{text}}
|
||||
####################
|
||||
|
||||
#########################
|
||||
# Cursor colors
|
||||
cursor {{text}}
|
||||
cursor_text_color {{depths}}
|
||||
cursor_trail_color {{yellow}}
|
||||
####################
|
||||
|
||||
#########################
|
||||
# URL colors
|
||||
url_color {{blue}}
|
||||
####################
|
||||
|
||||
#########################
|
||||
# window border colors and terminal bell colors
|
||||
active_border_color {{teal}}
|
||||
inactive_border_color {{stope}}
|
||||
bell_border_color {{orange}}
|
||||
# visual_bell_color none
|
||||
####################
|
||||
|
||||
|
||||
#########################
|
||||
# Tab bar colors
|
||||
active_tab_foreground {{text}}
|
||||
active_tab_background {{depths}}
|
||||
inactive_tab_foreground {{text}}
|
||||
inactive_tab_background {{stope}}
|
||||
# tab_bar_background {{pit}}
|
||||
# tab_bar_margin_color none
|
||||
####################
|
||||
|
||||
#########################
|
||||
# Marks colors
|
||||
# mark1_foreground black
|
||||
# mark1_background #98d3cb
|
||||
# mark2_foreground black
|
||||
# mark2_background #f2dcd3
|
||||
# mark3_foreground black
|
||||
# mark3_background #f274bc
|
||||
####################
|
||||
|
||||
|
||||
#########################
|
||||
# The basic 16 colors
|
||||
#: black
|
||||
color0 {{pit}}
|
||||
color8 {{stope}}
|
||||
|
||||
#: red
|
||||
color1 {{red}}
|
||||
color9 {{red}}
|
||||
|
||||
#: green
|
||||
color2 {{green}}
|
||||
color10 {{green}}
|
||||
|
||||
#: yellow
|
||||
color3 {{yellow}}
|
||||
color11 {{yellow}}
|
||||
|
||||
#: blue
|
||||
color4 {{blue}}
|
||||
color12 {{blue}}
|
||||
|
||||
#: magenta
|
||||
color5 {{purple}}
|
||||
color13 {{purple}}
|
||||
|
||||
#: cyan
|
||||
color6 {{teal}}
|
||||
color14 {{teal}}
|
||||
|
||||
#: white
|
||||
color7 {{text}}
|
||||
color15 {{text}}
|
||||
####################
|
|
@ -1 +0,0 @@
|
|||
https://neovim.io/doc/user/syntax.html
|
|
@ -1,3 +0,0 @@
|
|||
import buildNeovim from './src/build'
|
||||
|
||||
await buildNeovim()
|
|
@ -1,38 +0,0 @@
|
|||
import appRoot from 'app-root-path'
|
||||
import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file"
|
||||
import { common } from '../../../dist/palette.yml'
|
||||
import { spawn } from 'bun'
|
||||
|
||||
const file = appRoot + '/ports/neovim/estilos/palettes/verdigris.yml'
|
||||
const appendToEstilosPalette = async (content: string) => await appendToFile(file, content)
|
||||
|
||||
export default async function(isVerbose = false) {
|
||||
if (isVerbose) console.info('Neovim: Removing previous build', file)
|
||||
try {
|
||||
await rmFile(file)
|
||||
} catch (error) {
|
||||
console.info('Neovim: Previous build already removed')
|
||||
}
|
||||
if (isVerbose) console.info('Neovim: Ensuring path and file exist', file)
|
||||
await mkFilePath(file)
|
||||
if (isVerbose) console.info('Neovim: Writing color palette into file', file)
|
||||
await appendToEstilosPalette(colors())
|
||||
if (isVerbose) console.info('Neovim: Running estilo to compile `.vim`', file)
|
||||
await runEstilo(isVerbose)
|
||||
|
||||
return appRoot + '/ports/neovim/colors/verdigris.vim'
|
||||
}
|
||||
|
||||
function colors(): string {
|
||||
return Object
|
||||
.keys(common)
|
||||
.reduce((acc, key) => acc += `${key}: "${common[key]}"\n`, '')
|
||||
}
|
||||
|
||||
async function runEstilo(isVerbose: boolean) {
|
||||
const proc = spawn(['bun', 'estilo', 'render', appRoot + '/ports/neovim/'], {
|
||||
cwd: appRoot.toString(),
|
||||
});
|
||||
const output = await proc.stdout.text();
|
||||
if (isVerbose) console.info(output)
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
name = "{{name}}"
|
||||
version = "{{version}}"
|
||||
license = "{{license}}"
|
||||
sourcecode = "{{url}}"
|
||||
|
||||
[author]
|
||||
name = "{{author.name}}"
|
||||
email = "{{author.email}}"
|
||||
url = "{{author.url}}"
|
||||
|
||||
[colors]
|
||||
|
||||
{{#each colors}}
|
||||
[colors.{{this.nameSnakeCase}}]
|
||||
name = "{{this.name}}"
|
||||
l = {{this.l}}
|
||||
c = {{this.c}}
|
||||
h = {{this.h}}
|
||||
hex = "{{this.hex}}"
|
||||
|
||||
{{/each}}
|
|
@ -1,14 +0,0 @@
|
|||
name: "{{name}}"
|
||||
version: "{{version}}"
|
||||
license: "{{license}}"
|
||||
sourcecode: "{{url}}"
|
||||
|
||||
author:
|
||||
name: "{{author.name}}"
|
||||
email: "{{author.email}}"
|
||||
url: "{{author.url}}"
|
||||
|
||||
common:
|
||||
{{#each colors}}
|
||||
{{this.nameSnakeCase}}: "{{this.hex}}"
|
||||
{{/each}}
|
|
@ -1,42 +1,70 @@
|
|||
import { name, version, license, url, author } from '../../package.json'
|
||||
import appRoot from 'app-root-path'
|
||||
import { renderToFile } from "../helpers/file"
|
||||
import { rmFile, mkFilePath, appendToFile } from "../helpers/file"
|
||||
import colors from '../palette'
|
||||
import Color from '../helpers/color'
|
||||
import type color from '../helpers/color'
|
||||
import { toSnakeCase } from '../helpers/string'
|
||||
|
||||
const templateFile = appRoot + '/src/build/templates/toml.hbs'
|
||||
const outputFile = appRoot + '/dist/palette.toml'
|
||||
const file = appRoot + '/dist/palette.toml'
|
||||
const appendToTOML = async (content: string) => await appendToFile(file, content)
|
||||
|
||||
export default async function(isVerbose = false): Promise<string> {
|
||||
if (isVerbose) console.info('Removing previous build', file)
|
||||
try {
|
||||
await renderToFile(templateFile, outputFile, getData(), isVerbose)
|
||||
|
||||
return outputFile
|
||||
await rmFile(file)
|
||||
} catch (error) {
|
||||
throw error
|
||||
console.info('TOML: Previous build already removed')
|
||||
}
|
||||
if (isVerbose) console.info('Ensuring path and file exist', file)
|
||||
await mkFilePath(file)
|
||||
if (isVerbose) console.info('Writing header info to file', file)
|
||||
await appendToTOML(headerTOML())
|
||||
if (isVerbose) console.info('Writing author info to file', file)
|
||||
await appendToTOML(authorTOML())
|
||||
if (isVerbose) console.info('Writing color palette to file', file)
|
||||
await appendToTOML(colorHeaderTOML())
|
||||
for (let index = 0; index < colors.length; index++) {
|
||||
const color = colors[index]
|
||||
if (isVerbose) console.info(`${color.name}…`, file)
|
||||
await appendToTOML(colorTOML(color))
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
function getData(): any {
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
license,
|
||||
url,
|
||||
author,
|
||||
colors: colors.map(getDataColors)
|
||||
}
|
||||
function headerTOML(): string {
|
||||
return `name = "${name}"
|
||||
version = "${version}"
|
||||
license = "${license}"
|
||||
sourcecode = "${url}"
|
||||
`
|
||||
}
|
||||
|
||||
function getDataColors(color: Color): any {
|
||||
const { name, nameSnakeCase, l, c, h } = color
|
||||
function authorTOML(): string {
|
||||
const { name, email, url } = author
|
||||
|
||||
return {
|
||||
name,
|
||||
nameSnakeCase,
|
||||
l,
|
||||
c,
|
||||
h,
|
||||
hex: color.toHex()
|
||||
}
|
||||
return `
|
||||
[author]
|
||||
name = "${name}"
|
||||
email = "${email}"
|
||||
url = "${url}"
|
||||
`
|
||||
}
|
||||
|
||||
function colorHeaderTOML(): string {
|
||||
return `
|
||||
[colors]
|
||||
`
|
||||
}
|
||||
|
||||
function colorTOML(color: color): string {
|
||||
const { name, l, c, h } = color
|
||||
return `
|
||||
[colors.${toSnakeCase(name)}]
|
||||
name = "${name}"
|
||||
l = ${l}
|
||||
c = ${c}
|
||||
h = ${h}
|
||||
hex = "${color.toHex()}"
|
||||
`
|
||||
}
|
||||
|
|
|
@ -1,38 +1,62 @@
|
|||
import { name, version, license, url, author } from '../../package.json'
|
||||
import appRoot from 'app-root-path'
|
||||
import { rmFile, mkFilePath, appendToFile } from "../helpers/file"
|
||||
import { toSnakeCase } from '../helpers/string'
|
||||
import colors from '../palette'
|
||||
import Color from '../helpers/color'
|
||||
import { renderToFile } from '../helpers/file'
|
||||
import type color from '../helpers/color'
|
||||
|
||||
const templateFile = appRoot + '/src/build/templates/yaml.hbs'
|
||||
const outputFile = appRoot + '/dist/palette.yml'
|
||||
const file = appRoot + '/dist/palette.yml'
|
||||
const appendToYAML = async (content: string) => await appendToFile(file, content)
|
||||
|
||||
export default async function(isVerbose = false): Promise<string> {
|
||||
if (isVerbose) console.info('Removing previous build', file)
|
||||
try {
|
||||
await renderToFile(templateFile, outputFile, getData(), isVerbose)
|
||||
|
||||
return outputFile
|
||||
await rmFile(file)
|
||||
} catch (error) {
|
||||
throw error
|
||||
console.info('YAML: Previous build already removed')
|
||||
}
|
||||
if (isVerbose) console.info('Ensuring path and file exist', file)
|
||||
await mkFilePath(file)
|
||||
if (isVerbose) console.info('Writing header info to file', file)
|
||||
await appendToYAML(headerYAML())
|
||||
if (isVerbose) console.info('Writing author info to file', file)
|
||||
await appendToYAML(authorYAML())
|
||||
if (isVerbose) console.info('Writing color palette to file', file)
|
||||
await appendToYAML(colorHeaderYAML())
|
||||
for (let index = 0; index < colors.length; index++) {
|
||||
const color = colors[index]
|
||||
if (isVerbose) console.info(`${color.name}…`, file)
|
||||
await appendToYAML(colorYAML(color))
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
function getData(): any {
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
license,
|
||||
url,
|
||||
author,
|
||||
colors: colors.map(getDataColors)
|
||||
}
|
||||
function headerYAML(): string {
|
||||
return `name: "${name}"
|
||||
version: "${version}"
|
||||
license: "${license}"
|
||||
sourcecode: "${url}"
|
||||
`
|
||||
}
|
||||
|
||||
function getDataColors(color: Color): any {
|
||||
const { nameSnakeCase } = color
|
||||
function authorYAML(): string {
|
||||
const { name, email, url } = author
|
||||
|
||||
return {
|
||||
nameSnakeCase,
|
||||
hex: color.toHex()
|
||||
}
|
||||
return `
|
||||
author:
|
||||
name: "${name}"
|
||||
email: "${email}"
|
||||
url: "${url}"
|
||||
`
|
||||
}
|
||||
|
||||
function colorHeaderYAML(): string {
|
||||
return `
|
||||
common:`
|
||||
}
|
||||
|
||||
function colorYAML(color: color): string {
|
||||
return `
|
||||
${toSnakeCase(color.name)}: "${color.toHex()}"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import convert from 'color-convert'
|
||||
import { toSnakeCase } from './string'
|
||||
|
||||
export interface OklchInterface {
|
||||
l: number,
|
||||
|
@ -32,8 +31,6 @@ export default class {
|
|||
return true
|
||||
}
|
||||
|
||||
get nameSnakeCase() { return toSnakeCase(this.#name) }
|
||||
|
||||
get l() { return this.#l }
|
||||
set l(value: number) {
|
||||
if (this._isLValid(value)) this.#l = value
|
||||
|
|
|
@ -1,36 +1,25 @@
|
|||
import { compile } from 'handlebars';
|
||||
import { appendFile, mkdir, rm, readFile, writeFile } from 'node:fs/promises';
|
||||
import { appendFile, mkdir, rm } from 'node:fs/promises';
|
||||
import { dirname } from 'node:path'
|
||||
|
||||
const log = (isVerbose = true, ...rest: any[]) => {
|
||||
if (isVerbose) console.info(...rest)
|
||||
}
|
||||
|
||||
export async function mkFilePath(file: string, isVerbose = false) {
|
||||
export async function mkFilePath(file: string) {
|
||||
try {
|
||||
log(isVerbose, 'Ensuring path and file exist', file)
|
||||
await mkdir(dirname(file), { recursive: true })
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export async function renderToFile(
|
||||
templateFile: string, outputFile: string, data: any, isVerbose = false
|
||||
): Promise<string> {
|
||||
export async function rmFile(file: string) {
|
||||
try {
|
||||
await mkFilePath(outputFile, isVerbose)
|
||||
|
||||
log(isVerbose, 'Reading in template', templateFile)
|
||||
const template = (await readFile(templateFile)).toString()
|
||||
|
||||
log(isVerbose, 'Compiling template', templateFile, 'with data', data)
|
||||
const result = compile(template)(data)
|
||||
|
||||
log(isVerbose, 'Saving result', outputFile)
|
||||
await writeFile(outputFile, result)
|
||||
|
||||
return result
|
||||
await rm(file)
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export async function appendToFile(file: string, content: string) {
|
||||
try {
|
||||
await appendFile(file, content)
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
|
|
13
src/palette.toml
Normal file
13
src/palette.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
name = "verdigris"
|
||||
version = "0.0.1"
|
||||
|
||||
[author]
|
||||
name = "Gaiety"
|
||||
email = "ava+verdigris@gaiety.me"
|
||||
|
||||
[colors]
|
||||
|
||||
[colors.bg]
|
||||
l = 0.2
|
||||
c = 0.02
|
||||
h =
|
|
@ -91,20 +91,6 @@ export const purple = new Color('Purple', {
|
|||
h: absDegrees(hueLevels.teal + (hueOffset * 5)),
|
||||
})
|
||||
|
||||
export type Colors = {
|
||||
pit: string;
|
||||
depths: string;
|
||||
stope: string;
|
||||
text: string;
|
||||
orange: string;
|
||||
teal: string;
|
||||
red: string;
|
||||
yellow: string;
|
||||
green: string;
|
||||
blue: string;
|
||||
purple: string;
|
||||
}
|
||||
|
||||
export default [
|
||||
pit,
|
||||
depths,
|
||||
|
|
Loading…
Add table
Reference in a new issue