DrawBot modules I make / use
from DrawBotModules import Color
fg = Color.hex('#face')
bg = Color.hex('223344')
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:
Default: 1
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:
fg = Color.Hex('#002B36')
t = FormattedString()
t.fill(*fg.tuple)