Browse Source

Added readme, updated gitignore, added skeleton script

pull/1/head
Macoy Madson 5 years ago
parent
commit
6f463a4cf3
  1. 4
      .gitignore
  2. 28
      AutoBase16Theme.py
  3. 14
      ReadMe.org

4
.gitignore

@ -102,3 +102,7 @@ venv.bak/
# mypy
.mypy_cache/
LOCAL_*
colors.txt

28
AutoBase16Theme.py

@ -0,0 +1,28 @@
# AutoBase16Theme.py by Macoy Madson
# MIT License
# https://github.com/makuto/auto-base16-theme
def main():
colorsFile = open('colors.txt', 'r')
colorsLines = colorsFile.readlines()
colorsFile.close()
colors = ['#001b8c', '#0a126b', '#010e44', '#772e51', '#ca4733', '#381f4d', '#814174',
'#90142e', '#720d21', '#28217d', '#6d2c88', '#3b0010', '#6e095b', '#827e7b',
'#645361', '#560041']
if colorsLines:
colors = colorsLines
for color in colors:
print(color)
# From https://stackoverflow.com/questions/29643352/converting-hex-to-rgb-value-in-python
rgbColor = tuple(int(color.strip('#\n')[i:i+2], 16) for i in (0, 2 ,4))
print('RGB =', rgbColor)
if __name__ == '__main__':
main()

14
ReadMe.org

@ -0,0 +1,14 @@
* Auto Base16 Theme
This script generates a [[https://github.com/chriskempson/base16][base16]] color theme intended for code syntax highlighting.
I'm primarily focusing on doing this for Emacs, but it should work for any editor which supports base16.
** Setup
This script relies on [[https://github.com/thefryscorer/schemer2][schemer2]] to choose colors from images. It then takes the output of schemer2 and selects colors which fit the base16 format. Install schemer2:
: go get github.com/thefryscorer/schemer2
This script requires Python 3.
** How to Use
Run the following command, replacing "your image" with the image you want the theme's colors to be pulled from:
: schemer2 -format img::colors -in [your image] -out colors.txt && python3 AutoBase16Theme.py
Automating the execution of this so that it updates with your desktop background is left as an exercise for the reader :).
Loading…
Cancel
Save