diff options
Diffstat (limited to 'lib/threads/color.py')
| -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 |
