diff options
author | Chintalagiri Shashank <shashank.chintalagiri@gmail.com> | 2019-05-11 03:18:09 +0530 |
---|---|---|
committer | Chintalagiri Shashank <shashank.chintalagiri@gmail.com> | 2019-05-11 03:27:48 +0530 |
commit | 0c862895651a1d5b7f13e42a1af94fd4418b0400 (patch) | |
tree | 1c4e2ba2fb238f3a6bd994138b03cac97394b099 /gerber/render | |
parent | 2601ae8eab8d7be807bdbed264cd943e441a8da0 (diff) | |
download | gerbonara-0c862895651a1d5b7f13e42a1af94fd4418b0400.tar.gz gerbonara-0c862895651a1d5b7f13e42a1af94fd4418b0400.tar.bz2 gerbonara-0c862895651a1d5b7f13e42a1af94fd4418b0400.zip |
Add a new transparant theme for multilayer renders.
Diffstat (limited to 'gerber/render')
-rw-r--r-- | gerber/render/theme.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gerber/render/theme.py b/gerber/render/theme.py index 2887216..2f558a1 100644 --- a/gerber/render/theme.py +++ b/gerber/render/theme.py @@ -23,6 +23,7 @@ COLORS = { 'white': (1.0, 1.0, 1.0), 'red': (1.0, 0.0, 0.0), 'green': (0.0, 1.0, 0.0), + 'yellow': (1.0, 1.0, 0), 'blue': (0.0, 0.0, 1.0), 'fr-4': (0.290, 0.345, 0.0), 'green soldermask': (0.0, 0.412, 0.278), @@ -35,6 +36,18 @@ COLORS = { } +SPECTRUM = [ + (0.804, 0.216, 0), + (0.78, 0.776, 0.251), + (0.545, 0.451, 0.333), + (0.545, 0.137, 0.137), + (0.329, 0.545, 0.329), + (0.133, 0.545, 0.133), + (0, 0.525, 0.545), + (0.227, 0.373, 0.804), +] + + class Theme(object): def __init__(self, name=None, **kwargs): @@ -48,10 +61,22 @@ class Theme(object): self.bottom = kwargs.get('bottom', RenderSettings(COLORS['hasl copper'], mirror=True)) self.drill = kwargs.get('drill', RenderSettings(COLORS['black'])) self.ipc_netlist = kwargs.get('ipc_netlist', RenderSettings(COLORS['red'])) + self._internal = kwargs.get('internal', [RenderSettings(x) for x in SPECTRUM]) + self._internal_gen = None def __getitem__(self, key): return getattr(self, key) + @property + def internal(self): + if not self._internal_gen: + self._internal_gen = self._internal_gen_func() + return next(self._internal_gen) + + def _internal_gen_func(self): + for setting in self._internal: + yield setting + def get(self, key, noneval=None): val = getattr(self, key, None) return val if val is not None else noneval @@ -77,4 +102,11 @@ THEMES = { top=RenderSettings(COLORS['red'], alpha=0.5), bottom=RenderSettings(COLORS['blue'], alpha=0.5), drill=RenderSettings((0.3, 0.3, 0.3))), + + 'Transparent Multilayer': Theme(name='Transparent Multilayer', + background=RenderSettings((0, 0, 0)), + top=RenderSettings(SPECTRUM[0], alpha=0.8), + bottom=RenderSettings(SPECTRUM[-1], alpha=0.8), + drill=RenderSettings((0.3, 0.3, 0.3)), + internal=[RenderSettings(x, alpha=0.5) for x in SPECTRUM[1:-1]]), } |