initial (and only? ...nah) commit
This commit is contained in:
commit
c39c7cf20c
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Pass the name of a template, pipe in your scheme, result will be on stdout. You want to use a scheme from a file, just cat it.
|
||||||
|
|
||||||
|
Useful if you have something that generates base16 schemes ([\*cough\*](https://git.lain.church/whut/acid16)) and just want to pipe it into a template without too much trouble. Or if you just want an uncomplicated base16 builder.
|
21
noble.py
Executable file
21
noble.py
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import pystache, sys, yaml
|
||||||
|
|
||||||
|
inData = yaml.safe_load(sys.stdin.read())
|
||||||
|
template = open(sys.argv[1], 'r').read()
|
||||||
|
data = {'scheme-name': inData.get('scheme', 'Untitled'),
|
||||||
|
'scheme-author': inData.get('author', 'Anonymous'),
|
||||||
|
'scheme-slug': '<stdin>'}
|
||||||
|
|
||||||
|
for i in ["base%02X" % x for x in range(16)]:
|
||||||
|
colorHex = [inData[i][x*2:x*2+2] for x in range(3)]
|
||||||
|
color = [int(x, 16) for x in colorHex]
|
||||||
|
data[i + "-hex"] = inData[i]
|
||||||
|
data[i + "-hex-bgr"] = "".join(colorHex[::-1])
|
||||||
|
for c in range(3):
|
||||||
|
comp = "rgb"[c]
|
||||||
|
data[i + "-hex-" + comp] = colorHex[c]
|
||||||
|
data[i + "-rgb-" + comp] = color[c]
|
||||||
|
data[i + "-dec-" + comp] = color[c] / 255.0
|
||||||
|
|
||||||
|
print(pystache.render(template, data))
|
Loading…
Reference in New Issue
Block a user