From 8be1f3f82e0f17583cecab9c8a4763dda4ebc1e7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 18 Oct 2011 17:31:48 -0700 Subject: grc: tweaks for colors, added 64 int, vector darken --- grc/python/Constants.py | 12 +++++++----- grc/python/Port.py | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/grc/python/Constants.py b/grc/python/Constants.py index 4a234f080..ab547ea27 100644 --- a/grc/python/Constants.py +++ b/grc/python/Constants.py @@ -46,13 +46,15 @@ BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd') DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc') CORE_TYPES = ( #name, key, sizeof, color - ('Complex Float 64', 'fc64', 16, '#72f313'), + ('Complex Float 64', 'fc64', 16, '#CC8C69'), ('Complex Float 32', 'fc32', 8, '#3399FF'), - ('Complex Integer 32', 'sc32', 8, '#00b789'), - ('Complex Integer 16', 'sc16', 4, '#f37913'), - ('Complex Integer 8', 'sc8', 2, '#ff0e7f'), - ('Float 64', 'f64', 8, '#86a8fa'), + ('Complex Integer 64', 'sc64', 16, '#66CC00'), + ('Complex Integer 32', 'sc32', 8, '#33cc66'), + ('Complex Integer 16', 'sc16', 4, '#cccc00'), + ('Complex Integer 8', 'sc8', 2, '#cc00cc'), + ('Float 64', 'f64', 8, '#66CCCC'), ('Float 32', 'f32', 4, '#FF8C69'), + ('Integer 64', 's64', 8, '#99FF33'), ('Integer 32', 's32', 4, '#00FF99'), ('Integer 16', 's16', 2, '#FFFF66'), ('Integer 8', 's8', 1, '#FF66FF'), diff --git a/grc/python/Port.py b/grc/python/Port.py index 9baa81110..c2bfd9ccc 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -147,14 +147,16 @@ class Port(_Port, _GUIPort): """ try: color = Constants.TYPE_TO_COLOR[self.get_type()] - if self.get_vlen() == 1: return color + vlen = self.get_vlen() + if vlen == 1: return color color_val = int(color[1:], 16) r = (color_val >> 16) & 0xff g = (color_val >> 8) & 0xff b = (color_val >> 0) & 0xff - r = max(r-50, 0) - g = max(g-50, 0) - b = max(b-50, 0) + dark = (0, 0, 30, 50, 70)[min(4, vlen)] + r = max(r-dark, 0) + g = max(g-dark, 0) + b = max(b-dark, 0) return '#%.2x%.2x%.2x'%(r, g, b) except: return _Port.get_color(self) -- cgit