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]
|
||||
name = "Pit"
|
||||
l = 20
|
||||
c = 3
|
||||
h = 350
|
||||
hex = "#201018"
|
||||
l = 10
|
||||
c = 3.5
|
||||
h = 225
|
||||
hex = "#00040B"
|
||||
|
||||
[colors.depths]
|
||||
name = "Depths"
|
||||
l = 27
|
||||
c = 3
|
||||
h = 350
|
||||
hex = "#322028"
|
||||
l = 30
|
||||
c = 3.5
|
||||
h = 225
|
||||
hex = "#19323B"
|
||||
|
||||
[colors.stope]
|
||||
name = "Stope"
|
||||
l = 34
|
||||
c = 3
|
||||
h = 350
|
||||
hex = "#44323A"
|
||||
l = 50
|
||||
c = 3.5
|
||||
h = 225
|
||||
hex = "#4E6872"
|
||||
|
||||
[colors.text]
|
||||
name = "Text"
|
||||
l = 92
|
||||
c = 3
|
||||
h = 350
|
||||
hex = "#F5DDE7"
|
||||
l = 90
|
||||
c = 3.5
|
||||
h = 225
|
||||
hex = "#C6E4F0"
|
||||
|
||||
[colors.dark_red]
|
||||
name = "Dark Red"
|
||||
l = 82
|
||||
c = 12
|
||||
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
|
||||
[colors.orange]
|
||||
name = "Orange"
|
||||
l = 80
|
||||
c = 14
|
||||
h = 45
|
||||
hex = "#FFAB82"
|
||||
hex = "#FF9F6F"
|
||||
|
||||
[colors.light_orange]
|
||||
name = "Light Orange"
|
||||
l = 92
|
||||
c = 12
|
||||
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
|
||||
[colors.teal]
|
||||
name = "Teal"
|
||||
l = 80
|
||||
c = 14
|
||||
h = 180
|
||||
hex = "#5ADDC7"
|
||||
hex = "#23DBC1"
|
||||
|
||||
[colors.light_teal]
|
||||
name = "Light Teal"
|
||||
l = 92
|
||||
c = 12
|
||||
h = 180
|
||||
hex = "#7EFFE8"
|
||||
[colors.red]
|
||||
name = "Red"
|
||||
l = 80
|
||||
c = 7
|
||||
h = 22.5
|
||||
hex = "#E8ADA9"
|
||||
|
||||
[colors.dark_blue]
|
||||
name = "Dark Blue"
|
||||
l = 82
|
||||
c = 12
|
||||
h = 270
|
||||
hex = "#A6C0FF"
|
||||
[colors.yellow]
|
||||
name = "Yellow"
|
||||
l = 80
|
||||
c = 7
|
||||
h = 56.25
|
||||
hex = "#E1B392"
|
||||
|
||||
[colors.light_blue]
|
||||
name = "Light Blue"
|
||||
l = 92
|
||||
c = 12
|
||||
h = 270
|
||||
hex = "#C5E1FF"
|
||||
[colors.green]
|
||||
name = "Green"
|
||||
l = 80
|
||||
c = 7
|
||||
h = 157.5
|
||||
hex = "#98CCAC"
|
||||
|
||||
[colors.dark_purple]
|
||||
name = "Dark Purple"
|
||||
l = 82
|
||||
c = 12
|
||||
h = 315
|
||||
hex = "#E2ACFA"
|
||||
[colors.blue]
|
||||
name = "Blue"
|
||||
l = 80
|
||||
c = 7
|
||||
h = 225
|
||||
hex = "#8CC8E0"
|
||||
|
||||
[colors.light_purple]
|
||||
name = "Light Purple"
|
||||
l = 92
|
||||
c = 12
|
||||
h = 315
|
||||
hex = "#FFCCFF"
|
||||
[colors.purple]
|
||||
name = "Purple"
|
||||
l = 80
|
||||
c = 7
|
||||
h = 292.5
|
||||
hex = "#BEB6E8"
|
||||
|
15
index.ts
15
index.ts
|
@ -3,9 +3,16 @@ import { Command } from 'commander'
|
|||
import previewList from './src/preview/cli-list'
|
||||
import previewSnippet from './src/preview/cli-snippet'
|
||||
import buildTOML from './src/build/toml'
|
||||
import { nanoseconds } from 'bun';
|
||||
import { timerToSeconds } from './src/helpers/math';
|
||||
|
||||
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
|
||||
.name('verdigris')
|
||||
.description('Mining up the very best Color Palette')
|
||||
|
@ -30,10 +37,12 @@ program
|
|||
.description('compile toml and other consumable formats')
|
||||
.option('-v, --verbose', 'additional logs')
|
||||
.action(async (options) => {
|
||||
if (options.verbose) console.info('Building...')
|
||||
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();
|
||||
|
|
|
@ -7,7 +7,7 @@ import type color from '../helpers/color'
|
|||
const file = appRoot + '/dist/palette.toml'
|
||||
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)
|
||||
await rmFile(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)
|
||||
await appendToTOML(colorTOML(color))
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
function headerTOML(): string {
|
||||
|
|
|
@ -4,3 +4,9 @@ export function absDegrees(degrees: number): number {
|
|||
if (degrees < 0) return absDegrees(degrees * -1)
|
||||
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
|
||||
const lightnessLevels = {
|
||||
pit: 20,
|
||||
depths: 27,
|
||||
stope: 34,
|
||||
window: 82,
|
||||
mouth: 92,
|
||||
pit: 10,
|
||||
depths: 30,
|
||||
stope: 50,
|
||||
window: 80,
|
||||
mouth: 90,
|
||||
}
|
||||
|
||||
// Chrome 0-32
|
||||
const chromaLevels = {
|
||||
surface: 3,
|
||||
color: 12,
|
||||
surface: 3.5,
|
||||
colorSecondary: 7,
|
||||
colorPrimary: 14,
|
||||
}
|
||||
|
||||
// Degrees 0-360
|
||||
const hueLevels = {
|
||||
cave: 350,
|
||||
cave: 225,
|
||||
orange: 45,
|
||||
teal: 180,
|
||||
}
|
||||
const hueOffset = 45
|
||||
const hueOffset = 45 / 2
|
||||
|
||||
export const pit = new Color('Pit', {
|
||||
l: lightnessLevels.pit,
|
||||
|
@ -48,88 +49,46 @@ export const text = new Color('Text', {
|
|||
h: hueLevels.cave,
|
||||
})
|
||||
|
||||
export const darkRed = new Color('Dark Red', {
|
||||
export const teal = new Color('Teal', {
|
||||
l: lightnessLevels.window,
|
||||
c: chromaLevels.color,
|
||||
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,
|
||||
c: chromaLevels.colorPrimary,
|
||||
h: hueLevels.teal,
|
||||
})
|
||||
|
||||
export const lightTeal = new Color('Light Teal', {
|
||||
l: lightnessLevels.mouth,
|
||||
c: chromaLevels.color,
|
||||
h: hueLevels.teal,
|
||||
export const orange = new Color('Orange', {
|
||||
l: lightnessLevels.window,
|
||||
c: chromaLevels.colorPrimary,
|
||||
h: hueLevels.orange,
|
||||
})
|
||||
|
||||
export const darkBlue = new Color('Dark Blue', {
|
||||
export const red = new Color('Red', {
|
||||
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)),
|
||||
})
|
||||
|
||||
export const lightBlue = new Color('Light Blue', {
|
||||
l: lightnessLevels.mouth,
|
||||
c: chromaLevels.color,
|
||||
h: absDegrees(hueLevels.teal + (hueOffset * 2)),
|
||||
})
|
||||
|
||||
export const darkPurple = new Color('Dark Purple', {
|
||||
export const purple = new Color('Purple', {
|
||||
l: lightnessLevels.window,
|
||||
c: chromaLevels.color,
|
||||
h: absDegrees(hueLevels.teal + (hueOffset * 3)),
|
||||
})
|
||||
|
||||
export const lightPurple = new Color('Light Purple', {
|
||||
l: lightnessLevels.mouth,
|
||||
c: chromaLevels.color,
|
||||
h: absDegrees(hueLevels.teal + (hueOffset * 3)),
|
||||
c: chromaLevels.colorSecondary,
|
||||
h: absDegrees(hueLevels.teal + (hueOffset * 5)),
|
||||
})
|
||||
|
||||
export default [
|
||||
|
@ -137,18 +96,11 @@ export default [
|
|||
depths,
|
||||
stope,
|
||||
text,
|
||||
darkRed,
|
||||
lightRed,
|
||||
darkOrange,
|
||||
lightOrange,
|
||||
darkYellow,
|
||||
LightYellow,
|
||||
darkGreen,
|
||||
lightGreen,
|
||||
darkTeal,
|
||||
lightTeal,
|
||||
darkBlue,
|
||||
lightBlue,
|
||||
darkPurple,
|
||||
lightPurple,
|
||||
orange,
|
||||
teal,
|
||||
red,
|
||||
yellow,
|
||||
green,
|
||||
blue,
|
||||
purple,
|
||||
]
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
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 chalkDefinition = chalk.hex(darkTeal.toHex())
|
||||
const chalkVariable = chalk.hex(darkOrange.toHex())
|
||||
const chalkAssignments = chalk.hex(lightOrange.toHex())
|
||||
const chalkParenthesis = chalk.hex(darkPurple.toHex())
|
||||
const chalkParameter = chalk.hex(lightPurple.toHex())
|
||||
const chalkType = chalk.hex(darkBlue.toHex())
|
||||
const chalkReturn = chalk.hex(darkGreen.toHex())
|
||||
const chalkComment = chalk.italic.hex(stope.toHex())
|
||||
const chalkDefinition = chalk.hex(teal.toHex())
|
||||
const chalkVariable = chalk.hex(blue.toHex())
|
||||
const chalkAssignments = chalk.hex(green.toHex())
|
||||
const chalkParenthesis = chalk.hex(stope.toHex())
|
||||
const chalkParameter = chalk.hex(orange.toHex())
|
||||
const chalkType = chalk.hex(yellow.toHex())
|
||||
const chalkReturn = chalk.hex(purple.toHex())
|
||||
const chalkComment = chalk.italic.hex(depths.toHex())
|
||||
|
||||
export default () => {
|
||||
console.log(
|
||||
|
@ -18,7 +18,7 @@ ${chalkDefinition('const')}
|
|||
${chalkVariable('myFunc')}
|
||||
${chalkAssignments('=')}
|
||||
${chalkParenthesis('\(')}
|
||||
${chalkParameter('isAwesome')}
|
||||
${chalkParameter('isAwesome?')}
|
||||
:
|
||||
${chalkType('boolean')}
|
||||
${chalkParenthesis('\)')}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect, test } from 'bun:test'
|
||||
import { absDegrees } from '../../src/helpers/math'
|
||||
import { absDegrees, timerToSeconds } from '../../src/helpers/math'
|
||||
|
||||
test('degrees: 0 is valid', () => {
|
||||
expect(
|
||||
|
@ -64,3 +64,9 @@ test('degrees: if < 0 return equivilent degree within 360', () => {
|
|||
absDegrees(-720)
|
||||
).toBe(360)
|
||||
})
|
||||
|
||||
test('timer to seconds returns simple response', () => {
|
||||
expect(
|
||||
timerToSeconds([1, 23456789])
|
||||
).toBe(1.23)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue