diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2020-04-28 12:34:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-28 18:34:05 +0200 |
| commit | cb2b4e3522cb7f426ba5ad3e68deb9e6ccc581ec (patch) | |
| tree | 2a2f38823c3c9f0b5439ce2aa7c9040299109292 /lib/threads | |
| parent | eb526927e16954390d06929535d6f5c3766b5f6c (diff) | |
electron simulator (#531)
Diffstat (limited to 'lib/threads')
| -rw-r--r-- | lib/threads/color.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/threads/color.py b/lib/threads/color.py index 8c596e44..ea9dab06 100644 --- a/lib/threads/color.py +++ b/lib/threads/color.py @@ -1,7 +1,8 @@ -import simplestyle -import re import colorsys from pyembroidery.EmbThread import EmbThread +import re + +import simplestyle class ThreadColor(object): @@ -27,6 +28,20 @@ class ThreadColor(object): self.number = number self.manufacturer = manufacturer + def __json__(self): + jsonified = self._as_dict() + jsonified["visible_on_white"] = self.visible_on_white._as_dict() + + return jsonified + + def _as_dict(self): + return dict(name=self.name, + number=self.number, + manufacturer=self.manufacturer, + rgb=self.rgb, + hex=self.to_hex_str(), + ) + def __eq__(self, other): if isinstance(other, ThreadColor): return self.rgb == other.rgb |
