Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielgamage/drawbotmodules
DrawBot modules I make / use
https://github.com/danielgamage/drawbotmodules
Last synced: 12 days ago
JSON representation
DrawBot modules I make / use
- Host: GitHub
- URL: https://github.com/danielgamage/drawbotmodules
- Owner: danielgamage
- Created: 2016-08-02T04:52:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-02T05:30:18.000Z (over 8 years ago)
- Last Synced: 2024-10-18T19:01:43.525Z (about 1 month ago)
- Language: Python
- Size: 1.95 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DrawBotModules
[DrawBot](http://www.drawbot.com/) modules I make / use
```python
from DrawBotModules import Colorfg = Color.hex('#face')
bg = Color.hex('223344')
```## Color
### Color.hex(_string_)
The `Color.hex` interface parses hex strings into DrawBot-compatible RGBA floats. It supports several formats:- `#rgb`
- `#rgba`
- `#rrggbb`
- `#rrggbbaa`In all cases, the leading hashbang (`#`) is optional
The class then exposes the following properties:
#### `Color.r` _int_
#### `Color.g` _int_
#### `Color.b` _int_
#### `Color.a` _int_
Default: `1`
#### `Color.tuple` _tuple_
Default: `(Color.r, Color.g, Color.b, Color.a)`With this, you can either manually insert `rgba` values or splat / spread the tuple into a DrawBot `fill`/`stroke` function:
```python
fg = Color.Hex('#002B36')
t = FormattedString()
t.fill(*fg.tuple)
```