From 0da73d49edf42f2a092cdb33e84cb54023ff43ef Mon Sep 17 00:00:00 2001 From: Paul Houser Date: Mon, 24 Aug 2020 15:52:49 -0700 Subject: [PATCH] added theme selection --- config.yaml | 1 + init.py | 8 +++----- install.py | 12 +++++++++++- skeletons/style.css | 1 - themes/black-ice.css | 24 ++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 themes/black-ice.css diff --git a/config.yaml b/config.yaml index 48aeded..ef89585 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,5 @@ font_size: 22 +theme: void tree_1: general: github: "https://www.github.com/" diff --git a/init.py b/init.py index e67f7c8..cc68948 100755 --- a/init.py +++ b/init.py @@ -21,11 +21,6 @@ config_path = home + '/.config/StartTree/config.yaml' # get cache path cache_dir = home + '/.cache/StartTree' -def prettifyHTML(html): - soup = BeautifulSoup(html, 'html.parser') - prettyHTML = soup.prettify() - return prettyHTML - def setup(): # check if .config path exists if not os.path.isdir(home + '/.config'): @@ -57,6 +52,9 @@ def setup(): print("Creating '" + cache_dir + "'...") os.mkdir(cache_dir) + print("symlinking themes") + os.symlink(os.getcwd() + '/themes', home + '/.cache/StartTree/themes') + print("Creating '" + cache_dir + "/styles'") os.mkdir(cache_dir + '/styles') diff --git a/install.py b/install.py index 61b5962..d3f00f2 100755 --- a/install.py +++ b/install.py @@ -103,11 +103,21 @@ def gen_style(file_dict): skeleton_style = open('./skeletons/style.css', 'r') cache_style = open(cache_dir + '/styles/style.css', 'w') + # find style attributes in file_dict font_size = 20 + theme = "void" for key in file_dict: if key == "font_size": font_size = file_dict[key] - break + if key == "theme": + theme = file_dict[key] + + if theme == "pywal": + theme = home + '/.cache/wal/colors.css' + else: + theme = '../themes/' + theme + '.css' + + cache_style.write("@import url('" + theme + "');\n") lines = skeleton_style.readlines() for line in lines: diff --git a/skeletons/style.css b/skeletons/style.css index 59806b0..4192209 100644 --- a/skeletons/style.css +++ b/skeletons/style.css @@ -1,4 +1,3 @@ -@import url('/home/paul/.cache/wal/colors.css'); @font-face { font-family: "Roboto Mono"; src: url("./Hack.ttf"); diff --git a/themes/black-ice.css b/themes/black-ice.css new file mode 100644 index 0000000..523b860 --- /dev/null +++ b/themes/black-ice.css @@ -0,0 +1,24 @@ +:root { + /* Special */ + --background: #000000; + --foreground: #9a9c9f; + --cursor: #9a9c9f; + + /* Colors */ + --color0: #000000; + --color1: #04294d; + --color2: #2d2d2d; + --color3: #094c57; + --color4: #176485; + --color5: #585a5a; + --color6: #62909b; + --color7: #9a9c9f; + --color8: #36393f; + --color9: #04294d; + --color10: #2d2d2d; + --color11: #094c57; + --color12: #176485; + --color13: #585a5a; + --color14: #62909b; + --color15: #9a9c9f; +}