diff options
author | Paulo Henrique Silva <ph.silva@gmail.com> | 2019-11-25 23:51:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-25 23:51:37 -0300 |
commit | ab6aa538c1ac638c2e9f3e33580b88dd468b5caa (patch) | |
tree | 2d8534763aa94c9a6d766759b36e5fce039421bf /gerber/render | |
parent | 281c26ec3768bf1220f042e640a41efee28f2954 (diff) | |
parent | d5d618f0580bb4869463010493af0831bfb9e3d1 (diff) | |
download | gerbonara-ab6aa538c1ac638c2e9f3e33580b88dd468b5caa.tar.gz gerbonara-ab6aa538c1ac638c2e9f3e33580b88dd468b5caa.tar.bz2 gerbonara-ab6aa538c1ac638c2e9f3e33580b88dd468b5caa.zip |
Merge pull request #100 from chintal/multilayer
Add a new transparent 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]]), } |