feat: add machine-readable palette (#45)

* feat: add jq script for machine-readable palette

* feat: add machine-readable palette

* refactor: replace regex with jq filters

* build: add porcelain step to `package.json`

---------

Co-authored-by: winston <hey@winston.sh>
This commit is contained in:
Sam Nystrom 2023-04-01 21:03:16 -04:00 committed by GitHub
parent baa0469b86
commit df35c12c2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1375 additions and 1 deletions

View file

@ -15,7 +15,9 @@
},
"scripts": {
"test": "ava",
"build": "node esbuild.js",
"build:npm": "node esbuild.js",
"build:json": "jq -f porcelain.jq palette.json > palette-porcelain.json",
"build": "npm run build:npm && npm run build:json",
"prepublishOnly": "npm run build",
"release": "standard-version"
},

1362
palette-porcelain.json Normal file

File diff suppressed because it is too large Load diff

10
porcelain.jq Normal file
View file

@ -0,0 +1,10 @@
map_values(map_values({
hex: .hex | ltrimstr("#"),
rgb: .raw | split(", ") | map(tonumber),
hsl: .hsl
| ltrimstr("hsl(")
| rtrimstr(")")
| split(", ")
| map(rtrimstr("%") | tonumber)
| [ .[0], .[1] / 100, .[2] / 100 ]
}))