drawlib 0.1.7__tar.gz → 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of drawlib might be problematic. Click here for more details.

Files changed (63) hide show
  1. {drawlib-0.1.7 → drawlib-0.1.8}/PKG-INFO +1 -1
  2. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/__init__.py +1 -1
  3. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/apis.py +2 -1
  4. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/colors.py +3 -3
  5. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/dimage.py +67 -65
  6. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/fonts.py +2 -2
  7. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/model.py +7 -7
  8. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/theme_officials.py +24 -0
  9. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/base.py +0 -1
  10. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/image.py +9 -0
  11. {drawlib-0.1.7 → drawlib-0.1.8}/pyproject.toml +1 -1
  12. {drawlib-0.1.7 → drawlib-0.1.8}/LICENSE.txt +0 -0
  13. {drawlib-0.1.7 → drawlib-0.1.8}/README.md +0 -0
  14. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/.pylintrc +0 -0
  15. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/__main__.py +0 -0
  16. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/apis.py +0 -0
  17. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/assets/__init__.py +0 -0
  18. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/assets/v0_1/__init__.py +0 -0
  19. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/assets/v0_1/fonticons/__init__.py +0 -0
  20. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/assets/v0_1/fonts/__init__.py +0 -0
  21. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/__init__.py +0 -0
  22. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/__main__.py +0 -0
  23. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/__init__.py +0 -0
  24. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/command.py +0 -0
  25. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/__init__.py +0 -0
  26. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/theme.py +0 -0
  27. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/theme_styles.py +0 -0
  28. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core/util.py +0 -0
  29. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/__init__.py +0 -0
  30. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/canvas.py +0 -0
  31. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/line.py +0 -0
  32. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/original_arrow.py +0 -0
  33. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/original_polygon.py +0 -0
  34. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/patches.py +0 -0
  35. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/core_canvas/text.py +0 -0
  36. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/download.py +0 -0
  37. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/dutil.py +0 -0
  38. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/icons/__init__.py +0 -0
  39. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/icons/phosphor.py +0 -0
  40. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/icons/util.py +0 -0
  41. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/logging.py +0 -0
  42. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/settings.py +0 -0
  43. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/__init__.py +0 -0
  44. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/bubblespeech.py +0 -0
  45. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/cycle.py +0 -0
  46. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/dsart.py +0 -0
  47. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/groups.py +0 -0
  48. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/pyramid.py +0 -0
  49. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/sourcecode.py +0 -0
  50. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/table.py +0 -0
  51. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/smartarts/tree.py +0 -0
  52. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/util.py +0 -0
  53. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/__init__.py +0 -0
  54. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/args.py +0 -0
  55. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/color.py +0 -0
  56. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/coordinate.py +0 -0
  57. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/image.py +0 -0
  58. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/line.py +0 -0
  59. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/shape.py +0 -0
  60. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/smartarts.py +0 -0
  61. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/style.py +0 -0
  62. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/text.py +0 -0
  63. {drawlib-0.1.7 → drawlib-0.1.8}/drawlib/v0_1/private/validators/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drawlib
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Python drawing library. Illustration as Code.
5
5
  Home-page: https://www.drawlib.com
6
6
  Author: Yuichi Ito
@@ -24,7 +24,7 @@ subpackages contains latest and old implementations.
24
24
  from typing import Final
25
25
 
26
26
  # please update here when you release new version
27
- VERSION = "0.1.7"
27
+ VERSION = "0.1.8"
28
28
 
29
29
  # might not be changed
30
30
  LIB_NAME: Final[str] = "drawlib"
@@ -29,6 +29,7 @@ If you requires latest API, import root module instead.
29
29
  from drawlib.v0_1.private.core.colors import (
30
30
  Colors,
31
31
  Colors140,
32
+ ColorsBase,
32
33
  )
33
34
 
34
35
  from drawlib.v0_1.private.core.model import (
@@ -52,7 +53,7 @@ from drawlib.v0_1.private.core.fonts import (
52
53
  FontKorean,
53
54
  FontMonoSpace,
54
55
  FontRoboto,
55
- FontSanSerif,
56
+ FontSansSerif,
56
57
  FontSerif,
57
58
  FontSourceCode,
58
59
  FontThai,
@@ -32,7 +32,7 @@ Please don't use Enum for colors. Just RGB with tuple(int, int int) is good.
32
32
  from typing import Final, Tuple, Optional
33
33
 
34
34
 
35
- class BaseColors:
35
+ class ColorsBase:
36
36
  """Base class of Colors class
37
37
 
38
38
  Posses color ``Transparent`` and utility functions.
@@ -108,7 +108,7 @@ class BaseColors:
108
108
  return (rgb, rgb, rgb, alpha)
109
109
 
110
110
 
111
- class Colors(BaseColors):
111
+ class Colors(ColorsBase):
112
112
  """Web basic color class.
113
113
 
114
114
  Supports 16 of basic web colors.
@@ -134,7 +134,7 @@ class Colors(BaseColors):
134
134
  Yellow: Final[Tuple[int, int, int]] = (255, 255, 0)
135
135
 
136
136
 
137
- class Colors140(BaseColors):
137
+ class Colors140(ColorsBase):
138
138
  """Web colors class. CSS Color Module Level3.
139
139
 
140
140
  Supports 140 of "CSS Color Module Level3" web colors.
@@ -12,7 +12,7 @@
12
12
  drawlib depends on ``PIL.Image.Image`` for drawing image.
13
13
  It is very useful and easy to use.
14
14
  However, drawlib want to let user handle image **very very** easy.
15
- This module and its class ``Pimage`` achieves it.
15
+ This module and its class ``Dimage`` achieves it.
16
16
 
17
17
  """
18
18
 
@@ -41,7 +41,7 @@ class DimageCache:
41
41
  self._cache: Dict[str, Dimage] = {}
42
42
 
43
43
  def has(self, name: str) -> bool:
44
- """check whether having Pimage cache or not.
44
+ """check whether having Dimage cache or not.
45
45
 
46
46
  Args:
47
47
  name: cache name
@@ -53,8 +53,8 @@ class DimageCache:
53
53
 
54
54
  return name in self._cache
55
55
 
56
- def set(self, name: str, image: Dimage) -> None:
57
- """Set **copied** Pimage cache with provided name key.
56
+ def set(self, name: str, image: Union[str, Dimage, Image.Image]) -> None:
57
+ """Set **copied** Dimage cache with provided name key.
58
58
 
59
59
  This method copies original object and set copied one.
60
60
  It means you can modify original object after caching.
@@ -62,31 +62,31 @@ class DimageCache:
62
62
 
63
63
  Args:
64
64
  name: cache key.
65
- style: Pimage object which you want to cache.
65
+ image: file path or Dimage or PIL image.
66
66
 
67
67
  Returns:
68
68
  None
69
69
 
70
70
  """
71
71
 
72
- self._cache[name] = image.copy()
72
+ self._cache[name] = Dimage(image=image, copy=True)
73
73
 
74
74
  def list(self) -> List[str]:
75
75
  return list_(self._cache.keys())
76
76
 
77
77
  def get(self, name: str) -> Dimage:
78
- """Get **copied** Pimage cache via name(key).
78
+ """Get **copied** Dimage cache via name(key).
79
79
 
80
80
  This method doesn't return original object.
81
81
  But **copied** object.
82
- So, you can modify returned Pimage object.
83
- It doesn't harm original cached Pimage object.
82
+ So, you can modify returned Dimage object.
83
+ It doesn't harm original cached Dimage object.
84
84
 
85
85
  Args:
86
86
  name: cache key.
87
87
 
88
88
  Returns:
89
- Pimage: copy of original cached object.
89
+ Dimage: copy of original cached object.
90
90
 
91
91
  """
92
92
 
@@ -95,9 +95,9 @@ class DimageCache:
95
95
  return self._cache[name].copy()
96
96
 
97
97
  def delete(self, name: str) -> None:
98
- """Delete Pimage cache
98
+ """Delete Dimage cache
99
99
 
100
- Delete Pimage cache if exist.
100
+ Delete Dimage cache if exist.
101
101
  If not exist, just ignore deletion request.
102
102
 
103
103
  Args:
@@ -127,15 +127,15 @@ class Dimage:
127
127
  @error_handler
128
128
  def __init__(
129
129
  self,
130
- image: Union[str, Image.Image, Dimage],
130
+ image: Union[str, Dimage, Image.Image],
131
131
  copy: bool = False,
132
132
  ):
133
- """Initialize Pimage from file, PIL Image, Pimage.
133
+ """Initialize Dimage from file, PIL Image, Dimage.
134
134
 
135
- Initialize Pimage from file path, PIL Image, Pimage.
135
+ Initialize Dimage from file path, PIL Image, Dimage.
136
136
 
137
137
  Note:
138
- File path is relative to user code which calls ``Pimage()``.
138
+ File path is relative to user code which calls ``Dimage()``.
139
139
  Not from where you call python (default path behavior).
140
140
  If you want to have normal path behavior,
141
141
  convert relative path to absolute path.
@@ -164,14 +164,14 @@ class Dimage:
164
164
  self._pilimg = image._pilimg
165
165
 
166
166
  else:
167
- raise ValueError(f'Pimage does not support type "{type(image)}".')
167
+ raise ValueError(f'Dimage does not support type "{type(image)}".')
168
168
 
169
169
  @error_handler
170
170
  def get_pil_image(self) -> Image.Image:
171
171
  """Get **copied** PIL Image.
172
172
 
173
- Get **copied** PIL Image which Pimage instance holds.
174
- Modification to the PIL Image has no effects to Pimage.
173
+ Get **copied** PIL Image which Dimage instance holds.
174
+ Modification to the PIL Image has no effects to Dimage.
175
175
 
176
176
  Returns:
177
177
  PIL.Image.Image: copy of PIL Image.
@@ -187,12 +187,12 @@ class Dimage:
187
187
 
188
188
  @error_handler
189
189
  def copy(self) -> Dimage:
190
- """Get copied Pimage
190
+ """Get copied Dimage
191
191
 
192
- Create another Pimage instance which has same content.
192
+ Create another Dimage instance which has same content.
193
193
 
194
194
  Returns:
195
- Pimage: deep copied image
195
+ Dimage: deep copied image
196
196
 
197
197
  """
198
198
 
@@ -200,7 +200,7 @@ class Dimage:
200
200
 
201
201
  @error_handler
202
202
  def save(self, file: str) -> None:
203
- """Save Pimage data to file
203
+ """Save Dimage data to file
204
204
 
205
205
  Save to specified file path.
206
206
  Path is relative to script file which calls this method.
@@ -221,6 +221,7 @@ class Dimage:
221
221
  os.makedirs(directory, exist_ok=True)
222
222
  self._pilimg.save(abspath, quality=95)
223
223
 
224
+ '''
224
225
  @error_handler
225
226
  def border(
226
227
  self,
@@ -239,15 +240,15 @@ class Dimage:
239
240
 
240
241
  @error_handler
241
242
  def rotate(self, angle: float) -> Dimage:
242
- """Get rotated new Pimage. Original Pimage is keeped.
243
+ """Get rotated new Dimage. Original Dimage is keeped.
243
244
 
244
- Get new Pimage which has rotated.
245
+ Get new Dimage which has rotated.
245
246
 
246
247
  Args:
247
248
  angle: between 0.0 ~ 360. pixel size can be changed. New area becomes transparent.
248
249
 
249
250
  Returns:
250
- Pimage: new rotated image.
251
+ Dimage: new rotated image.
251
252
 
252
253
  """
253
254
 
@@ -257,19 +258,20 @@ class Dimage:
257
258
  expand=True,
258
259
  )
259
260
  return Dimage(newimg)
261
+ '''
260
262
 
261
263
  @error_handler
262
264
  def resize(self, width: int, height: int) -> Dimage:
263
- """Get resized new Pimage. Original Pimage is keeped.
265
+ """Get resized new Dimage. Original Dimage is keeped.
264
266
 
265
- Get new Pimage which has resized.
267
+ Get new Dimage which has resized.
266
268
 
267
269
  Args:
268
270
  width: new image width
269
271
  height: new image height
270
272
 
271
273
  Returns:
272
- Pimage: new rotated image.
274
+ Dimage: new rotated image.
273
275
 
274
276
  """
275
277
 
@@ -281,12 +283,12 @@ class Dimage:
281
283
 
282
284
  @error_handler
283
285
  def flip(self) -> Dimage:
284
- """Get flipped new Pimage. Original Pimage is keeped.
286
+ """Get flipped new Dimage. Original Dimage is keeped.
285
287
 
286
- Get new Pimage which has flip effect.
288
+ Get new Dimage which has flip effect.
287
289
 
288
290
  Returns:
289
- Pimage: new flipped image.
291
+ Dimage: new flipped image.
290
292
 
291
293
  """
292
294
 
@@ -295,12 +297,12 @@ class Dimage:
295
297
 
296
298
  @error_handler
297
299
  def mirror(self) -> Dimage:
298
- """Get mirrored new Pimage. Original Pimage is keeped.
300
+ """Get mirrored new Dimage. Original Dimage is keeped.
299
301
 
300
- Get new Pimage which has mirror effect.
302
+ Get new Dimage which has mirror effect.
301
303
 
302
304
  Returns:
303
- Pimage: new mirror image.
305
+ Dimage: new mirror image.
304
306
 
305
307
  """
306
308
 
@@ -309,12 +311,12 @@ class Dimage:
309
311
 
310
312
  @error_handler
311
313
  def invert(self) -> Dimage:
312
- """Get inverted new Pimage. Original Pimage is keeped.
314
+ """Get inverted new Dimage. Original Dimage is keeped.
313
315
 
314
- Get new Pimage which has invert effect.
316
+ Get new Dimage which has invert effect.
315
317
 
316
318
  Returns:
317
- Pimage: new inverted image.
319
+ Dimage: new inverted image.
318
320
 
319
321
  """
320
322
 
@@ -335,12 +337,12 @@ class Dimage:
335
337
 
336
338
  @error_handler
337
339
  def grayscale(self) -> Dimage:
338
- """Get grayscaled new Pimage. Original Pimage is keeped.
340
+ """Get grayscaled new Dimage. Original Dimage is keeped.
339
341
 
340
- Get new Pimage which has grayscale effect.
342
+ Get new Dimage which has grayscale effect.
341
343
 
342
344
  Returns:
343
- Pimage: new grayscaled image.
345
+ Dimage: new grayscaled image.
344
346
 
345
347
  """
346
348
 
@@ -349,12 +351,12 @@ class Dimage:
349
351
 
350
352
  @error_handler
351
353
  def brightness(self, brightness_: float = 0.5) -> Dimage:
352
- """Get brightness changed new Pimage. Original Pimage is keeped.
354
+ """Get brightness changed new Dimage. Original Dimage is keeped.
353
355
 
354
- Get new Pimage which has change brightness effect.
356
+ Get new Dimage which has change brightness effect.
355
357
 
356
358
  Returns:
357
- Pimage: new brightness changed image.
359
+ Dimage: new brightness changed image.
358
360
 
359
361
  """
360
362
 
@@ -364,12 +366,12 @@ class Dimage:
364
366
 
365
367
  @error_handler
366
368
  def sepia(self) -> Dimage:
367
- """Get sepia color new Pimage. Original Pimage is keeped.
369
+ """Get sepia color new Dimage. Original Dimage is keeped.
368
370
 
369
- Get new Pimage which has sepia effect.
371
+ Get new Dimage which has sepia effect.
370
372
 
371
373
  Returns:
372
- Pimage: new sepia color image.
374
+ Dimage: new sepia color image.
373
375
 
374
376
  """
375
377
 
@@ -398,12 +400,12 @@ class Dimage:
398
400
  # black: Union[str, Tuple[int, int, int]],
399
401
  # white: Union[str, Tuple[int, int, int]],
400
402
  ) -> Dimage:
401
- """Get colorized new Pimage. Original Pimage is keeped.
403
+ """Get colorized new Dimage. Original Dimage is keeped.
402
404
 
403
- Get new Pimage which has colorize effect.
405
+ Get new Dimage which has colorize effect.
404
406
 
405
407
  Returns:
406
- Pimage: new colorized image.
408
+ Dimage: new colorized image.
407
409
 
408
410
  """
409
411
 
@@ -419,12 +421,12 @@ class Dimage:
419
421
 
420
422
  @error_handler
421
423
  def posterize(self, num_colors: int = 4) -> Dimage:
422
- """Get posterized new Pimage. Original Pimage is keeped.
424
+ """Get posterized new Dimage. Original Dimage is keeped.
423
425
 
424
- Get new Pimage which has posterized effect.
426
+ Get new Dimage which has posterized effect.
425
427
 
426
428
  Returns:
427
- Pimage: new posterized image.
429
+ Dimage: new posterized image.
428
430
 
429
431
  """
430
432
 
@@ -441,12 +443,12 @@ class Dimage:
441
443
 
442
444
  @error_handler
443
445
  def mosaic(self) -> Dimage:
444
- """Get mosiac new Pimage. Original Pimage is keeped.
446
+ """Get mosiac new Dimage. Original Dimage is keeped.
445
447
 
446
- Get new Pimage which has mosaic effect.
448
+ Get new Dimage which has mosaic effect.
447
449
 
448
450
  Returns:
449
- Pimage: new mosaic image.
451
+ Dimage: new mosaic image.
450
452
 
451
453
  """
452
454
 
@@ -459,12 +461,12 @@ class Dimage:
459
461
 
460
462
  @error_handler
461
463
  def blur(self) -> Dimage:
462
- """Get blur new Pimage. Original Pimage is keeped.
464
+ """Get blur new Dimage. Original Dimage is keeped.
463
465
 
464
- Get new Pimage which has blur effect.
466
+ Get new Dimage which has blur effect.
465
467
 
466
468
  Returns:
467
- Pimage: new blur image.
469
+ Dimage: new blur image.
468
470
 
469
471
  """
470
472
 
@@ -473,12 +475,12 @@ class Dimage:
473
475
 
474
476
  @error_handler
475
477
  def line_extraction(self) -> Dimage:
476
- """Get line extracted new Pimage. Original Pimage is keeped.
478
+ """Get line extracted new Dimage. Original Dimage is keeped.
477
479
 
478
- Get new Pimage which has line extraction effect.
480
+ Get new Dimage which has line extraction effect.
479
481
 
480
482
  Returns:
481
- Pimage: new line extracted image.
483
+ Dimage: new line extracted image.
482
484
 
483
485
  """
484
486
 
@@ -493,12 +495,12 @@ class Dimage:
493
495
  self,
494
496
  margin_color: Union[None, str, Tuple[int, int, int]],
495
497
  ) -> Dimage:
496
- """Get margin removed new Pimage. Original Pimage is keeped.
498
+ """Get margin removed new Dimage. Original Dimage is keeped.
497
499
 
498
- Get new Pimage which has margin removed.
500
+ Get new Dimage which has margin removed.
499
501
 
500
502
  Returns:
501
- Pimage: new margin removed image.
503
+ Dimage: new margin removed image.
502
504
 
503
505
  """
504
506
 
@@ -70,7 +70,7 @@ class FontFile:
70
70
  # - Font: English + CJK
71
71
  #
72
72
  # Alphabet
73
- # - FontSanSerif
73
+ # - FontSansSerif
74
74
  # - FontSans
75
75
  # - FontMonoSpace
76
76
  # - FontRoboto
@@ -129,7 +129,7 @@ class Font(FontBase):
129
129
  )
130
130
 
131
131
 
132
- class FontSanSerif(FontBase):
132
+ class FontSansSerif(FontBase):
133
133
  """Drawlib Fonts.
134
134
 
135
135
  Drawlib avoid using system font since it depends on host OS.
@@ -36,7 +36,7 @@ from drawlib.v0_1.private.core.fonts import (
36
36
  FontArabic,
37
37
  FontBase,
38
38
  FontSerif,
39
- FontSanSerif,
39
+ FontSansSerif,
40
40
  FontChinese,
41
41
  FontJapanese,
42
42
  FontKorean,
@@ -661,7 +661,7 @@ class ShapeTextStyle:
661
661
  FontArabic,
662
662
  FontBase,
663
663
  FontSerif,
664
- FontSanSerif,
664
+ FontSansSerif,
665
665
  FontChinese,
666
666
  FontJapanese,
667
667
  FontKorean,
@@ -759,7 +759,7 @@ class ShapeTextStyle:
759
759
  FontArabic,
760
760
  FontBase,
761
761
  FontSerif,
762
- FontSanSerif,
762
+ FontSansSerif,
763
763
  FontChinese,
764
764
  FontJapanese,
765
765
  FontKorean,
@@ -780,7 +780,7 @@ class ShapeTextStyle:
780
780
  FontArabic,
781
781
  FontBase,
782
782
  FontSerif,
783
- FontSanSerif,
783
+ FontSansSerif,
784
784
  FontChinese,
785
785
  FontJapanese,
786
786
  FontKorean,
@@ -886,7 +886,7 @@ class TextStyle:
886
886
  FontArabic,
887
887
  FontBase,
888
888
  FontSerif,
889
- FontSanSerif,
889
+ FontSansSerif,
890
890
  FontChinese,
891
891
  FontJapanese,
892
892
  FontKorean,
@@ -988,7 +988,7 @@ class TextStyle:
988
988
  FontArabic,
989
989
  FontBase,
990
990
  FontSerif,
991
- FontSanSerif,
991
+ FontSansSerif,
992
992
  FontChinese,
993
993
  FontJapanese,
994
994
  FontKorean,
@@ -1009,7 +1009,7 @@ class TextStyle:
1009
1009
  FontArabic,
1010
1010
  FontBase,
1011
1011
  FontSerif,
1012
- FontSanSerif,
1012
+ FontSansSerif,
1013
1013
  FontChinese,
1014
1014
  FontJapanese,
1015
1015
  FontKorean,
@@ -104,6 +104,30 @@ def get_default() -> _ThemeReturnValue:
104
104
  )
105
105
 
106
106
 
107
+ def get_flat_ui_palette_v1() -> _ThemeReturnValue:
108
+ # https://flatuicolors.com/palette/defo
109
+ turquoise = (26, 188, 156)
110
+ green_sea = (22, 160, 133)
111
+ emerald = (46, 204, 113)
112
+ nephritis = (39, 174, 96)
113
+ peter_river = (52, 152, 219)
114
+ belize_hole = (41, 128, 185)
115
+ amethyst = (155, 89, 182)
116
+ wisteria = (142, 68, 173)
117
+ wet_asphalt = (52, 73, 94)
118
+ midnight_blue = (44, 62, 80)
119
+ sun_flower = (241, 196, 15)
120
+ orange = (243, 156, 18)
121
+ carrot = (230, 126, 34)
122
+ pumpkin = (211, 84, 0)
123
+ alizarin = (231, 76, 60)
124
+ pomegranate = (192, 57, 43)
125
+ clouds = (236, 240, 241)
126
+ silver = (189, 195, 199)
127
+ concrete = (149, 165, 166)
128
+ asbestos = (127, 140, 141)
129
+
130
+
107
131
  def get_gray() -> _ThemeReturnValue:
108
132
  """Change theme to gray.
109
133
 
@@ -66,7 +66,6 @@ class CanvasBase:
66
66
  DEFAULT_GRID_ONLY: Final[bool] = False
67
67
  DEFAULT_GRID_STYLE: Final[LineStyle] = LineStyle(width=1, color=Colors.Gray, style="dashed")
68
68
  DEFAULT_GRID_CENTERSTYLE: Final[LineStyle] = LineStyle(width=2, color=Colors.Gray, style="dashed")
69
- SYSTEM_FONTS = ["serif", "sanserif"]
70
69
 
71
70
  @error_handler
72
71
  def __init__(self) -> None:
@@ -127,6 +127,15 @@ class CanvasImageFeature(CanvasPatchesFeature):
127
127
  # create image drawing object
128
128
  pil_image = pimg.get_pil_image()
129
129
  im = numpy.array(pil_image)
130
+
131
+ # grayscale doesn't work fine on matplotlib. convert to RGBA.
132
+ if im.ndim == 3:
133
+ if im.shape[2] == 2:
134
+ gray = im[:, :, 0]
135
+ alpha = im[:, :, 1]
136
+ rgb_array = numpy.stack((gray, gray, gray), axis=-1)
137
+ im = numpy.concatenate((rgb_array, alpha[:, :, numpy.newaxis]), axis=-1)
138
+
130
139
  imagebox = offsetbox.OffsetImage(im, zoom=zoom)
131
140
  ab = offsetbox.AnnotationBbox(imagebox, (x, y), frameon=False)
132
141
 
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "drawlib"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Python drawing library. Illustration as Code."
9
9
  homepage = "https://www.drawlib.com"
10
10
  repository = "https://github.com/yuichi110/drawlib"
File without changes
File without changes
File without changes
File without changes
File without changes