Compare commits
3 commits
ab60e53cac
...
61b13c8533
Author | SHA1 | Date | |
---|---|---|---|
![]() |
61b13c8533 | ||
![]() |
215a3a18e4 | ||
![]() |
aef0a1c1ce |
7 changed files with 140 additions and 214 deletions
161
dist/palette.toml
vendored
161
dist/palette.toml
vendored
|
@ -12,127 +12,78 @@ url = https://gaiety.me
|
||||||
|
|
||||||
[colors.pit]
|
[colors.pit]
|
||||||
name = "Pit"
|
name = "Pit"
|
||||||
l = 20
|
l = 10
|
||||||
c = 3
|
c = 3.5
|
||||||
h = 350
|
h = 225
|
||||||
hex = "#201018"
|
hex = "#00040B"
|
||||||
|
|
||||||
[colors.depths]
|
[colors.depths]
|
||||||
name = "Depths"
|
name = "Depths"
|
||||||
l = 27
|
l = 30
|
||||||
c = 3
|
c = 3.5
|
||||||
h = 350
|
h = 225
|
||||||
hex = "#322028"
|
hex = "#19323B"
|
||||||
|
|
||||||
[colors.stope]
|
[colors.stope]
|
||||||
name = "Stope"
|
name = "Stope"
|
||||||
l = 34
|
l = 50
|
||||||
c = 3
|
c = 3.5
|
||||||
h = 350
|
h = 225
|
||||||
hex = "#44323A"
|
hex = "#4E6872"
|
||||||
|
|
||||||
[colors.text]
|
[colors.text]
|
||||||
name = "Text"
|
name = "Text"
|
||||||
l = 92
|
l = 90
|
||||||
c = 3
|
c = 3.5
|
||||||
h = 350
|
h = 225
|
||||||
hex = "#F5DDE7"
|
hex = "#C6E4F0"
|
||||||
|
|
||||||
[colors.dark_red]
|
[colors.orange]
|
||||||
name = "Dark Red"
|
name = "Orange"
|
||||||
l = 82
|
l = 80
|
||||||
c = 12
|
c = 14
|
||||||
h = 0
|
|
||||||
hex = "#FFA3C1"
|
|
||||||
|
|
||||||
[colors.light_red]
|
|
||||||
name = "Light Red"
|
|
||||||
l = 92
|
|
||||||
c = 12
|
|
||||||
h = 0
|
|
||||||
hex = "#FFC3E1"
|
|
||||||
|
|
||||||
[colors.dark_orange]
|
|
||||||
name = "Dark Orange"
|
|
||||||
l = 82
|
|
||||||
c = 12
|
|
||||||
h = 45
|
h = 45
|
||||||
hex = "#FFAB82"
|
hex = "#FF9F6F"
|
||||||
|
|
||||||
[colors.light_orange]
|
[colors.teal]
|
||||||
name = "Light Orange"
|
name = "Teal"
|
||||||
l = 92
|
l = 80
|
||||||
c = 12
|
c = 14
|
||||||
h = 45
|
|
||||||
hex = "#FFCBA1"
|
|
||||||
|
|
||||||
[colors.dark_yellow]
|
|
||||||
name = "Dark Yellow"
|
|
||||||
l = 82
|
|
||||||
c = 12
|
|
||||||
h = 90
|
|
||||||
hex = "#E2C162"
|
|
||||||
|
|
||||||
[colors.light_yellow]
|
|
||||||
name = "Light Yellow"
|
|
||||||
l = 92
|
|
||||||
c = 12
|
|
||||||
h = 90
|
|
||||||
hex = "#FFE183"
|
|
||||||
|
|
||||||
[colors.dark_green]
|
|
||||||
name = "Dark Green"
|
|
||||||
l = 82
|
|
||||||
c = 12
|
|
||||||
h = 135
|
|
||||||
hex = "#A2D686"
|
|
||||||
|
|
||||||
[colors.light_green]
|
|
||||||
name = "Light Green"
|
|
||||||
l = 92
|
|
||||||
c = 12
|
|
||||||
h = 135
|
|
||||||
hex = "#C2F7A5"
|
|
||||||
|
|
||||||
[colors.dark_teal]
|
|
||||||
name = "Dark Teal"
|
|
||||||
l = 82
|
|
||||||
c = 12
|
|
||||||
h = 180
|
h = 180
|
||||||
hex = "#5ADDC7"
|
hex = "#23DBC1"
|
||||||
|
|
||||||
[colors.light_teal]
|
[colors.red]
|
||||||
name = "Light Teal"
|
name = "Red"
|
||||||
l = 92
|
l = 80
|
||||||
c = 12
|
c = 7
|
||||||
h = 180
|
h = 22.5
|
||||||
hex = "#7EFFE8"
|
hex = "#E8ADA9"
|
||||||
|
|
||||||
[colors.dark_blue]
|
[colors.yellow]
|
||||||
name = "Dark Blue"
|
name = "Yellow"
|
||||||
l = 82
|
l = 80
|
||||||
c = 12
|
c = 7
|
||||||
h = 270
|
h = 56.25
|
||||||
hex = "#A6C0FF"
|
hex = "#E1B392"
|
||||||
|
|
||||||
[colors.light_blue]
|
[colors.green]
|
||||||
name = "Light Blue"
|
name = "Green"
|
||||||
l = 92
|
l = 80
|
||||||
c = 12
|
c = 7
|
||||||
h = 270
|
h = 157.5
|
||||||
hex = "#C5E1FF"
|
hex = "#98CCAC"
|
||||||
|
|
||||||
[colors.dark_purple]
|
[colors.blue]
|
||||||
name = "Dark Purple"
|
name = "Blue"
|
||||||
l = 82
|
l = 80
|
||||||
c = 12
|
c = 7
|
||||||
h = 315
|
h = 225
|
||||||
hex = "#E2ACFA"
|
hex = "#8CC8E0"
|
||||||
|
|
||||||
[colors.light_purple]
|
[colors.purple]
|
||||||
name = "Light Purple"
|
name = "Purple"
|
||||||
l = 92
|
l = 80
|
||||||
c = 12
|
c = 7
|
||||||
h = 315
|
h = 292.5
|
||||||
hex = "#FFCCFF"
|
hex = "#BEB6E8"
|
||||||
|
|
15
index.ts
15
index.ts
|
@ -3,9 +3,16 @@ import { Command } from 'commander'
|
||||||
import previewList from './src/preview/cli-list'
|
import previewList from './src/preview/cli-list'
|
||||||
import previewSnippet from './src/preview/cli-snippet'
|
import previewSnippet from './src/preview/cli-snippet'
|
||||||
import buildTOML from './src/build/toml'
|
import buildTOML from './src/build/toml'
|
||||||
|
import { nanoseconds } from 'bun';
|
||||||
|
import { timerToSeconds } from './src/helpers/math';
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
|
async function log(isVerbose: true, file: string, timer: [number, number]) {
|
||||||
|
const time: string = isVerbose ? ` ${timerToSeconds(timer)} seconds` : ''
|
||||||
|
console.info(`${file}${time}`)
|
||||||
|
}
|
||||||
|
|
||||||
program
|
program
|
||||||
.name('verdigris')
|
.name('verdigris')
|
||||||
.description('Mining up the very best Color Palette')
|
.description('Mining up the very best Color Palette')
|
||||||
|
@ -30,10 +37,12 @@ program
|
||||||
.description('compile toml and other consumable formats')
|
.description('compile toml and other consumable formats')
|
||||||
.option('-v, --verbose', 'additional logs')
|
.option('-v, --verbose', 'additional logs')
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
if (options.verbose) console.info('Building...')
|
|
||||||
const timer = process.hrtime()
|
const timer = process.hrtime()
|
||||||
await buildTOML()
|
|
||||||
console.info(`Built in ${timer[0]} seconds`)
|
if (options.verbose) console.info('Building Direct Exports...')
|
||||||
|
log(options.verbose, await buildTOML(), timer)
|
||||||
|
|
||||||
|
if (options.verbose) console.info('Building Ports...')
|
||||||
});
|
});
|
||||||
|
|
||||||
program.parse();
|
program.parse();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type color from '../helpers/color'
|
||||||
const file = appRoot + '/dist/palette.toml'
|
const file = appRoot + '/dist/palette.toml'
|
||||||
const appendToTOML = async (content: string) => await appendToFile(file, content)
|
const appendToTOML = async (content: string) => await appendToFile(file, content)
|
||||||
|
|
||||||
export default async function(isVerbose = false) {
|
export default async function(isVerbose = false): Promise<string> {
|
||||||
if (isVerbose) console.info('Removing previous build', file)
|
if (isVerbose) console.info('Removing previous build', file)
|
||||||
await rmFile(file)
|
await rmFile(file)
|
||||||
if (isVerbose) console.info('Ensuring path and file exist', file)
|
if (isVerbose) console.info('Ensuring path and file exist', file)
|
||||||
|
@ -23,6 +23,8 @@ export default async function(isVerbose = false) {
|
||||||
if (isVerbose) console.info(`${color.name}…`, file)
|
if (isVerbose) console.info(`${color.name}…`, file)
|
||||||
await appendToTOML(colorTOML(color))
|
await appendToTOML(colorTOML(color))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
function headerTOML(): string {
|
function headerTOML(): string {
|
||||||
|
|
|
@ -4,3 +4,9 @@ export function absDegrees(degrees: number): number {
|
||||||
if (degrees < 0) return absDegrees(degrees * -1)
|
if (degrees < 0) return absDegrees(degrees * -1)
|
||||||
return degrees
|
return degrees
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function timerToSeconds([seconds, nanoseconds]: [number, number]): number {
|
||||||
|
const digitRounding = 1000000
|
||||||
|
const toDecimal = 100
|
||||||
|
return seconds + (Math.round(nanoseconds / digitRounding) / toDecimal)
|
||||||
|
}
|
||||||
|
|
140
src/palette.ts
140
src/palette.ts
|
@ -3,26 +3,27 @@ import { absDegrees } from './helpers/math'
|
||||||
|
|
||||||
// Lightness 0-100
|
// Lightness 0-100
|
||||||
const lightnessLevels = {
|
const lightnessLevels = {
|
||||||
pit: 20,
|
pit: 10,
|
||||||
depths: 27,
|
depths: 30,
|
||||||
stope: 34,
|
stope: 50,
|
||||||
window: 82,
|
window: 80,
|
||||||
mouth: 92,
|
mouth: 90,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chrome 0-32
|
// Chrome 0-32
|
||||||
const chromaLevels = {
|
const chromaLevels = {
|
||||||
surface: 3,
|
surface: 3.5,
|
||||||
color: 12,
|
colorSecondary: 7,
|
||||||
|
colorPrimary: 14,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Degrees 0-360
|
// Degrees 0-360
|
||||||
const hueLevels = {
|
const hueLevels = {
|
||||||
cave: 350,
|
cave: 225,
|
||||||
orange: 45,
|
orange: 45,
|
||||||
teal: 180,
|
teal: 180,
|
||||||
}
|
}
|
||||||
const hueOffset = 45
|
const hueOffset = 45 / 2
|
||||||
|
|
||||||
export const pit = new Color('Pit', {
|
export const pit = new Color('Pit', {
|
||||||
l: lightnessLevels.pit,
|
l: lightnessLevels.pit,
|
||||||
|
@ -48,88 +49,46 @@ export const text = new Color('Text', {
|
||||||
h: hueLevels.cave,
|
h: hueLevels.cave,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const darkRed = new Color('Dark Red', {
|
export const teal = new Color('Teal', {
|
||||||
l: lightnessLevels.window,
|
l: lightnessLevels.window,
|
||||||
c: chromaLevels.color,
|
c: chromaLevels.colorPrimary,
|
||||||
h: absDegrees(hueLevels.orange - hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const lightRed = new Color('Light Red', {
|
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.orange - hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const darkOrange = new Color('Dark Orange', {
|
|
||||||
l: lightnessLevels.window,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: hueLevels.orange,
|
|
||||||
})
|
|
||||||
|
|
||||||
export const lightOrange = new Color('Light Orange', {
|
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: hueLevels.orange,
|
|
||||||
})
|
|
||||||
|
|
||||||
export const darkYellow = new Color('Dark Yellow', {
|
|
||||||
l: lightnessLevels.window,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.orange + hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const LightYellow = new Color('Light Yellow', {
|
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.orange + hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const darkGreen = new Color('Dark Green', {
|
|
||||||
l: lightnessLevels.window,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.teal - hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const lightGreen = new Color('Light Green', {
|
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.teal - hueOffset),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const darkTeal = new Color('Dark Teal', {
|
|
||||||
l: lightnessLevels.window,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: hueLevels.teal,
|
h: hueLevels.teal,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const lightTeal = new Color('Light Teal', {
|
export const orange = new Color('Orange', {
|
||||||
l: lightnessLevels.mouth,
|
l: lightnessLevels.window,
|
||||||
c: chromaLevels.color,
|
c: chromaLevels.colorPrimary,
|
||||||
h: hueLevels.teal,
|
h: hueLevels.orange,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const darkBlue = new Color('Dark Blue', {
|
export const red = new Color('Red', {
|
||||||
l: lightnessLevels.window,
|
l: lightnessLevels.window,
|
||||||
c: chromaLevels.color,
|
c: chromaLevels.colorSecondary,
|
||||||
|
h: absDegrees(hueLevels.orange - hueOffset),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const yellow = new Color('Yellow', {
|
||||||
|
l: lightnessLevels.window,
|
||||||
|
c: chromaLevels.colorSecondary,
|
||||||
|
h: absDegrees(hueLevels.orange + (hueOffset / 2)),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const green = new Color('Green', {
|
||||||
|
l: lightnessLevels.window,
|
||||||
|
c: chromaLevels.colorSecondary,
|
||||||
|
h: absDegrees(hueLevels.teal - hueOffset),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const blue = new Color('Blue', {
|
||||||
|
l: lightnessLevels.window,
|
||||||
|
c: chromaLevels.colorSecondary,
|
||||||
h: absDegrees(hueLevels.teal + (hueOffset * 2)),
|
h: absDegrees(hueLevels.teal + (hueOffset * 2)),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const lightBlue = new Color('Light Blue', {
|
export const purple = new Color('Purple', {
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.teal + (hueOffset * 2)),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const darkPurple = new Color('Dark Purple', {
|
|
||||||
l: lightnessLevels.window,
|
l: lightnessLevels.window,
|
||||||
c: chromaLevels.color,
|
c: chromaLevels.colorSecondary,
|
||||||
h: absDegrees(hueLevels.teal + (hueOffset * 3)),
|
h: absDegrees(hueLevels.teal + (hueOffset * 5)),
|
||||||
})
|
|
||||||
|
|
||||||
export const lightPurple = new Color('Light Purple', {
|
|
||||||
l: lightnessLevels.mouth,
|
|
||||||
c: chromaLevels.color,
|
|
||||||
h: absDegrees(hueLevels.teal + (hueOffset * 3)),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
@ -137,18 +96,11 @@ export default [
|
||||||
depths,
|
depths,
|
||||||
stope,
|
stope,
|
||||||
text,
|
text,
|
||||||
darkRed,
|
orange,
|
||||||
lightRed,
|
teal,
|
||||||
darkOrange,
|
red,
|
||||||
lightOrange,
|
yellow,
|
||||||
darkYellow,
|
green,
|
||||||
LightYellow,
|
blue,
|
||||||
darkGreen,
|
purple,
|
||||||
lightGreen,
|
|
||||||
darkTeal,
|
|
||||||
lightTeal,
|
|
||||||
darkBlue,
|
|
||||||
lightBlue,
|
|
||||||
darkPurple,
|
|
||||||
lightPurple,
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import { pit, text, darkTeal, darkOrange, lightOrange, darkPurple, lightPurple, darkBlue, darkGreen, stope } from '../palette'
|
import { pit, depths, stope, text, teal, orange, purple, blue, green, yellow } from '../palette'
|
||||||
|
|
||||||
const bg = chalk.bgHex(pit.toHex()).hex(text.toHex())
|
const bg = chalk.bgHex(pit.toHex()).hex(text.toHex())
|
||||||
const chalkDefinition = chalk.hex(darkTeal.toHex())
|
const chalkDefinition = chalk.hex(teal.toHex())
|
||||||
const chalkVariable = chalk.hex(darkOrange.toHex())
|
const chalkVariable = chalk.hex(blue.toHex())
|
||||||
const chalkAssignments = chalk.hex(lightOrange.toHex())
|
const chalkAssignments = chalk.hex(green.toHex())
|
||||||
const chalkParenthesis = chalk.hex(darkPurple.toHex())
|
const chalkParenthesis = chalk.hex(stope.toHex())
|
||||||
const chalkParameter = chalk.hex(lightPurple.toHex())
|
const chalkParameter = chalk.hex(orange.toHex())
|
||||||
const chalkType = chalk.hex(darkBlue.toHex())
|
const chalkType = chalk.hex(yellow.toHex())
|
||||||
const chalkReturn = chalk.hex(darkGreen.toHex())
|
const chalkReturn = chalk.hex(purple.toHex())
|
||||||
const chalkComment = chalk.italic.hex(stope.toHex())
|
const chalkComment = chalk.italic.hex(depths.toHex())
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -18,7 +18,7 @@ ${chalkDefinition('const')}
|
||||||
${chalkVariable('myFunc')}
|
${chalkVariable('myFunc')}
|
||||||
${chalkAssignments('=')}
|
${chalkAssignments('=')}
|
||||||
${chalkParenthesis('\(')}
|
${chalkParenthesis('\(')}
|
||||||
${chalkParameter('isAwesome')}
|
${chalkParameter('isAwesome?')}
|
||||||
:
|
:
|
||||||
${chalkType('boolean')}
|
${chalkType('boolean')}
|
||||||
${chalkParenthesis('\)')}
|
${chalkParenthesis('\)')}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect, test } from 'bun:test'
|
import { expect, test } from 'bun:test'
|
||||||
import { absDegrees } from '../../src/helpers/math'
|
import { absDegrees, timerToSeconds } from '../../src/helpers/math'
|
||||||
|
|
||||||
test('degrees: 0 is valid', () => {
|
test('degrees: 0 is valid', () => {
|
||||||
expect(
|
expect(
|
||||||
|
@ -64,3 +64,9 @@ test('degrees: if < 0 return equivilent degree within 360', () => {
|
||||||
absDegrees(-720)
|
absDegrees(-720)
|
||||||
).toBe(360)
|
).toBe(360)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('timer to seconds returns simple response', () => {
|
||||||
|
expect(
|
||||||
|
timerToSeconds([1, 23456789])
|
||||||
|
).toBe(1.23)
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue