From 2a9e65350544d326b601ef7e7067bdf80620f799 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Tue, 7 Dec 2021 22:56:32 -0300 Subject: [PATCH] Graph (#357) * Add theme graph colors * Fix graph not applying colors --- screen.py | 4 ++-- styles/colorized/style.conf | 20 ++++++++++++++++++++ styles/material-dark/style.conf | 20 ++++++++++++++++++++ styles/material-darker/style.conf | 20 ++++++++++++++++++++ styles/material-light/style.conf | 20 ++++++++++++++++++++ styles/z-bolt/style.conf | 20 ++++++++++++++++++++ 6 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 styles/colorized/style.conf create mode 100644 styles/material-dark/style.conf create mode 100644 styles/material-darker/style.conf create mode 100644 styles/material-light/style.conf create mode 100644 styles/z-bolt/style.conf diff --git a/screen.py b/screen.py index 4b1a1260..3852be8c 100644 --- a/screen.py +++ b/screen.py @@ -452,8 +452,6 @@ class KlipperScreen(Gtk.Window): style_options = json.load(f) f.close() - self.gtk.color_list = style_options['graph_colors'] - if os.path.exists(klipperscreendir + "/styles/%s/style.conf" % (self.theme)): try: f = open(klipperscreendir + "/styles/%s/style.conf" % (self.theme)) @@ -462,6 +460,8 @@ class KlipperScreen(Gtk.Window): except Exception: logging.error("Unable to parse custom template conf file.") + self.gtk.color_list = style_options['graph_colors'] + for i in range(len(style_options['graph_colors']['extruder']['colors'])): num = "" if i == 0 else i+1 css_data += "\n.graph_label_extruder%s {border-left-color: #%s}" % ( diff --git a/styles/colorized/style.conf b/styles/colorized/style.conf new file mode 100644 index 00000000..324f6c2b --- /dev/null +++ b/styles/colorized/style.conf @@ -0,0 +1,20 @@ +{ + "graph_colors": { + "extruder": { + "colors": ["DC322F", "B58900", "CB4B16", "AA1F1D", "973911"], + "state": 0 + }, + "bed": { + "colors": ["268BD2"], + "state": 0 + }, + "fan": { + "colors": ["859900", "2AA198", "637300", "1F7A72"], + "state": 0 + }, + "sensor": { + "colors": ["D33682", "6C71C4", "C06CC4", "6D26D1", "2A34A1"], + "state": 0 + } + } +} diff --git a/styles/material-dark/style.conf b/styles/material-dark/style.conf new file mode 100644 index 00000000..1479c56a --- /dev/null +++ b/styles/material-dark/style.conf @@ -0,0 +1,20 @@ +{ + "graph_colors": { + "extruder": { + "colors": ["C62828", "9C27B0", "F06292", "F44336", "6A1B9A"], + "state": 0 + }, + "bed": { + "colors": ["00B0FF"], + "state": 0 + }, + "fan": { + "colors": ["558B2F", "8BC34A", "00695C", "009688"], + "state": 0 + }, + "sensor": { + "colors": ["FF8F00", "3F51B5", "9E9D24", "CDDC39", "FFC107"], + "state": 0 + } + } +} diff --git a/styles/material-darker/style.conf b/styles/material-darker/style.conf new file mode 100644 index 00000000..1479c56a --- /dev/null +++ b/styles/material-darker/style.conf @@ -0,0 +1,20 @@ +{ + "graph_colors": { + "extruder": { + "colors": ["C62828", "9C27B0", "F06292", "F44336", "6A1B9A"], + "state": 0 + }, + "bed": { + "colors": ["00B0FF"], + "state": 0 + }, + "fan": { + "colors": ["558B2F", "8BC34A", "00695C", "009688"], + "state": 0 + }, + "sensor": { + "colors": ["FF8F00", "3F51B5", "9E9D24", "CDDC39", "FFC107"], + "state": 0 + } + } +} diff --git a/styles/material-light/style.conf b/styles/material-light/style.conf new file mode 100644 index 00000000..1479c56a --- /dev/null +++ b/styles/material-light/style.conf @@ -0,0 +1,20 @@ +{ + "graph_colors": { + "extruder": { + "colors": ["C62828", "9C27B0", "F06292", "F44336", "6A1B9A"], + "state": 0 + }, + "bed": { + "colors": ["00B0FF"], + "state": 0 + }, + "fan": { + "colors": ["558B2F", "8BC34A", "00695C", "009688"], + "state": 0 + }, + "sensor": { + "colors": ["FF8F00", "3F51B5", "9E9D24", "CDDC39", "FFC107"], + "state": 0 + } + } +} diff --git a/styles/z-bolt/style.conf b/styles/z-bolt/style.conf new file mode 100644 index 00000000..6212dcd8 --- /dev/null +++ b/styles/z-bolt/style.conf @@ -0,0 +1,20 @@ +{ + "graph_colors": { + "extruder": { + "colors": ["ED6500", "ED8500", "EDA500", "EDC500", "EDF500"], + "state": 0 + }, + "bed": { + "colors": ["009384"], + "state": 0 + }, + "fan": { + "colors": ["A7E100", "7ECE21", "AAA920", "AC7140"], + "state": 0 + }, + "sensor": { + "colors": ["B10080", "7800B0", "AC4958", "B1A080", "B1C080"], + "state": 0 + } + } +}