omnipython-apps 0.1.4.dev8__py3-none-any.whl

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.
Files changed (218) hide show
  1. apps/__init__.py +5 -0
  2. apps/about/__init__.py +257 -0
  3. apps/about/app.json +1 -0
  4. apps/about/credits.py +12 -0
  5. apps/about/facts.py +398 -0
  6. apps/about/fonts/OFL.txt +93 -0
  7. apps/about/fonts/latin1_14.bin +0 -0
  8. apps/about/fonts/latin1_16.bin +0 -0
  9. apps/about/fonts/latin1_24.bin +0 -0
  10. apps/about/fonts/latin1_32.bin +0 -0
  11. apps/about/fonts/latin1_40.bin +0 -0
  12. apps/backline/__init__.py +58 -0
  13. apps/backline/app.json +1 -0
  14. apps/backline/app.py +475 -0
  15. apps/backline/art.py +717 -0
  16. apps/backline/ask.py +781 -0
  17. apps/backline/box.py +502 -0
  18. apps/backline/cast.py +137 -0
  19. apps/backline/desk/__init__.py +329 -0
  20. apps/backline/desk/editor.py +331 -0
  21. apps/backline/desk/grid.py +154 -0
  22. apps/backline/desk/look.py +169 -0
  23. apps/backline/desk/pedals.py +102 -0
  24. apps/backline/desk/perform.py +157 -0
  25. apps/backline/desk/prompt.py +210 -0
  26. apps/backline/desk/strip.py +159 -0
  27. apps/backline/desk_main.py +226 -0
  28. apps/backline/engine.py +622 -0
  29. apps/backline/floor.py +509 -0
  30. apps/backline/footswitch.py +119 -0
  31. apps/backline/glyphs.py +82 -0
  32. apps/backline/kits.py +428 -0
  33. apps/backline/midipedal.py +362 -0
  34. apps/backline/page_data.py +413 -0
  35. apps/backline/parts.py +145 -0
  36. apps/backline/pedal.py +107 -0
  37. apps/backline/remote.py +134 -0
  38. apps/backline/songs/ballad_68.json +1 -0
  39. apps/backline/songs/bossa.json +1 -0
  40. apps/backline/songs/country_train.json +1 -0
  41. apps/backline/songs/funk.json +1 -0
  42. apps/backline/songs/metal.json +1 -0
  43. apps/backline/songs/pop.json +1 -0
  44. apps/backline/songs/rock.json +1 -0
  45. apps/backline/songs/shuffle.json +1 -0
  46. apps/battery/__init__.py +101 -0
  47. apps/battery/app.json +1 -0
  48. apps/bit_world/act_deck.py +683 -0
  49. apps/bit_world/act_game.py +762 -0
  50. apps/bit_world/act_pet.py +1032 -0
  51. apps/bit_world/app.json +1 -0
  52. apps/bit_world/bit_output.py +45 -0
  53. apps/bit_world/bit_palette.py +503 -0
  54. apps/bit_world/bit_sound.py +431 -0
  55. apps/bit_world/bit_sprites.py +632 -0
  56. apps/bit_world/bit_world.py +534 -0
  57. apps/btreceiver/__init__.py +690 -0
  58. apps/btreceiver/app.json +1 -0
  59. apps/btreceiver/chime.py +155 -0
  60. apps/btreceiver/demo.py +529 -0
  61. apps/btreceiver/screen.py +633 -0
  62. apps/camera/__init__.py +316 -0
  63. apps/camera/app.json +1 -0
  64. apps/card/__init__.py +113 -0
  65. apps/card/app.json +1 -0
  66. apps/cast/__init__.py +631 -0
  67. apps/cast/app.json +1 -0
  68. apps/cast/receivers.py +193 -0
  69. apps/chess/__init__.py +18 -0
  70. apps/chess/app.json +1 -0
  71. apps/chess/app.py +922 -0
  72. apps/chess/art.py +323 -0
  73. apps/chess/ble.py +411 -0
  74. apps/chess/engine.py +925 -0
  75. apps/chess/game.py +327 -0
  76. apps/chess/net.py +261 -0
  77. apps/clock/__init__.py +38 -0
  78. apps/clock/app.json +1 -0
  79. apps/detect/__init__.py +214 -0
  80. apps/detect/app.json +1 -0
  81. apps/fmsynth/__init__.py +41 -0
  82. apps/fmsynth/algorithms.py +61 -0
  83. apps/fmsynth/app.json +1 -0
  84. apps/fmsynth/app.py +355 -0
  85. apps/fmsynth/editor.py +206 -0
  86. apps/fmsynth/engine.py +257 -0
  87. apps/fmsynth/meters.py +262 -0
  88. apps/fmsynth/midi.py +375 -0
  89. apps/fmsynth/panel_view.py +1071 -0
  90. apps/fmsynth/patches/fmsynth-01.syx +0 -0
  91. apps/fmsynth/settings.py +138 -0
  92. apps/fmsynth/voice.py +398 -0
  93. apps/gamepad/__init__.py +685 -0
  94. apps/gamepad/app.json +1 -0
  95. apps/gamepad/pad.py +94 -0
  96. apps/gamepad/watch.py +352 -0
  97. apps/hidden/__init__.py +72 -0
  98. apps/hidden/app.json +1 -0
  99. apps/home/__init__.py +483 -0
  100. apps/home/app.json +1 -0
  101. apps/home/main.py +36 -0
  102. apps/homeassistant/__init__.py +213 -0
  103. apps/homeassistant/api.py +104 -0
  104. apps/homeassistant/app.json +1 -0
  105. apps/huey/__init__.py +287 -0
  106. apps/huey/acting.py +184 -0
  107. apps/huey/actor.py +194 -0
  108. apps/huey/app.json +1 -0
  109. apps/huey/client.py +125 -0
  110. apps/huey/servers.py +121 -0
  111. apps/huey/settings.example.json +8 -0
  112. apps/huey/settings.py +97 -0
  113. apps/huey/turn.py +504 -0
  114. apps/huey/voice.py +217 -0
  115. apps/info/__init__.py +810 -0
  116. apps/info/app.json +1 -0
  117. apps/lora/__init__.py +62 -0
  118. apps/lora/app.json +1 -0
  119. apps/manifest.py +71 -0
  120. apps/medialink_baby_monitor/__init__.py +222 -0
  121. apps/medialink_baby_monitor/app.json +1 -0
  122. apps/medialink_doorbell/__init__.py +251 -0
  123. apps/medialink_doorbell/app.json +1 -0
  124. apps/medialink_hands_free/__init__.py +217 -0
  125. apps/medialink_hands_free/app.json +1 -0
  126. apps/medialink_surveillance_camera/__init__.py +258 -0
  127. apps/medialink_surveillance_camera/app.json +1 -0
  128. apps/medialink_video_doorbell/__init__.py +289 -0
  129. apps/medialink_video_doorbell/app.json +1 -0
  130. apps/medialink_videophone/__init__.py +273 -0
  131. apps/medialink_videophone/app.json +1 -0
  132. apps/medialink_walkie_talkie/__init__.py +228 -0
  133. apps/medialink_walkie_talkie/app.json +1 -0
  134. apps/midicontroller/__init__.py +774 -0
  135. apps/midicontroller/app.json +1 -0
  136. apps/midicontroller/links.py +421 -0
  137. apps/midicontroller/surface.py +343 -0
  138. apps/midiengine/__init__.py +977 -0
  139. apps/midiengine/app.json +1 -0
  140. apps/midiengine/banks.py +85 -0
  141. apps/midiengine/midiin.py +165 -0
  142. apps/midiengine/player.py +392 -0
  143. apps/midiengine/umidiparser.py +1413 -0
  144. apps/mp3/__init__.py +240 -0
  145. apps/mp3/app.json +1 -0
  146. apps/perch/__init__.py +119 -0
  147. apps/perch/app.json +1 -0
  148. apps/perch/huey.py +481 -0
  149. apps/perch/huey_props.py +386 -0
  150. apps/perch/huey_shift.py +42 -0
  151. apps/perch/huey_views.py +296 -0
  152. apps/perch/scene_bench.py +680 -0
  153. apps/perch/scene_coast.py +479 -0
  154. apps/perch/scene_desk.py +492 -0
  155. apps/perch/stage.py +1274 -0
  156. apps/perch/vec.py +366 -0
  157. apps/repl/__init__.py +325 -0
  158. apps/repl/app.json +1 -0
  159. apps/roku/__init__.py +156 -0
  160. apps/roku/app.json +1 -0
  161. apps/rokucam/__init__.py +362 -0
  162. apps/rokucam/app.json +1 -0
  163. apps/security/__init__.py +261 -0
  164. apps/security/app.json +1 -0
  165. apps/settings/__init__.py +221 -0
  166. apps/settings/app.json +1 -0
  167. apps/shell/__init__.py +33 -0
  168. apps/shell/app.json +1 -0
  169. apps/spotify/__init__.py +669 -0
  170. apps/spotify/app.json +1 -0
  171. apps/spotify/screen.py +82 -0
  172. apps/steps/__init__.py +58 -0
  173. apps/steps/app.json +1 -0
  174. apps/stompbox/__init__.py +31 -0
  175. apps/stompbox/app.json +1 -0
  176. apps/stompbox/app.py +668 -0
  177. apps/stompbox/boards.json +20 -0
  178. apps/stompbox/effects.py +241 -0
  179. apps/stompbox/engine.py +340 -0
  180. apps/stompbox/footswitch.py +331 -0
  181. apps/stompbox/inputs.py +449 -0
  182. apps/stompbox/meter.py +72 -0
  183. apps/stompbox/outputs.py +135 -0
  184. apps/stompbox/pedals.txt +45 -0
  185. apps/stompbox/presets.py +106 -0
  186. apps/stompbox/styles.py +135 -0
  187. apps/stompbox/ui.py +817 -0
  188. apps/stompbox/wavfile.py +73 -0
  189. apps/synthstation/__init__.py +20 -0
  190. apps/synthstation/app.json +1 -0
  191. apps/synthstation/audio.py +397 -0
  192. apps/synthstation/catalog.py +50 -0
  193. apps/synthstation/meters.py +136 -0
  194. apps/synthstation/midi.py +380 -0
  195. apps/synthstation/pads.py +177 -0
  196. apps/synthstation/parts.py +128 -0
  197. apps/synthstation/station.py +1069 -0
  198. apps/system/__init__.py +11 -0
  199. apps/system/app.json +1 -0
  200. apps/touchcal/__init__.py +324 -0
  201. apps/touchcal/app.json +1 -0
  202. apps/touchcal/fit.py +262 -0
  203. apps/wake/__init__.py +268 -0
  204. apps/wake/app.json +1 -0
  205. apps/wake/feed.py +155 -0
  206. apps/watch/__init__.py +355 -0
  207. apps/watch/app.json +1 -0
  208. apps/watch/faces.py +35 -0
  209. apps/watch/wheel.py +157 -0
  210. apps/weather/__init__.py +278 -0
  211. apps/weather/app.json +1 -0
  212. apps/weather/icons.py +172 -0
  213. apps/weather/sizing.py +71 -0
  214. apps/weather/zippad.py +172 -0
  215. omnipython_apps-0.1.4.dev8.dist-info/METADATA +33 -0
  216. omnipython_apps-0.1.4.dev8.dist-info/RECORD +218 -0
  217. omnipython_apps-0.1.4.dev8.dist-info/WHEEL +5 -0
  218. omnipython_apps-0.1.4.dev8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,386 @@
1
+ # SPDX-FileCopyrightText: 2026 Brad Barnett
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """Things the chameleon holds, and the chameleon holding them.
5
+
6
+ Each prop is a function that returns shapes with its grip at the origin and
7
+ the prop pointing up, so `vec.at` stands it in a hand. `hold` draws the
8
+ chameleon with one hand raised, the prop in it and his toes closed round the
9
+ handle.
10
+ """
11
+
12
+ import math
13
+
14
+ from . import huey
15
+ from .vec import at, circle, ellipse, group, limb, line, path, pts, rect, smooth
16
+
17
+ NAVY = 0x0B2A4A
18
+ LIME = 0xC4DC4C
19
+ WHITE = 0xFFFFFF
20
+ _STEEL = 0xC9D2DC
21
+ _STEEL_DARK = 0x8A97A6
22
+ _STEEL_LIGHT = 0xF1F5F9
23
+ _INK = 0x2B2B33
24
+ _RED = 0xE4513D
25
+ _RED_DARK = 0xB23A2B
26
+ _GOLD = 0xF4B43A
27
+ _GOLD_DARK = 0xC98A1E
28
+ _WOOD = 0xD9A066
29
+ _WOOD_DARK = 0xA9743F
30
+ _CREAM = 0xFFF6E0
31
+
32
+
33
+ def _smoke(turn):
34
+ # smoke and steam rise straight up, whichever way the prop leans
35
+ wisps = path("M0 0C-9 -12 9 -22 0 -36C-8 -48 7 -56 1 -70", None, WHITE, 4.5, opacity=0.5) + path(
36
+ "M9 -8C3 -18 16 -26 10 -40", None, WHITE, 3, opacity=0.32
37
+ )
38
+ return group(wisps, "rotate(%.1f)" % -turn)
39
+
40
+
41
+ def iron(turn=0):
42
+ """A soldering iron, hot, with its wisp of smoke."""
43
+ return (
44
+ path("M-3 24Q-12 44 -4 62", None, _INK, 4)
45
+ + rect(-8, -22, 16, 46, 0x1C6E8C, r=7)
46
+ + rect(-8, -22, 6, 46, 0x145670, r=3)
47
+ + rect(-9, -30, 18, 10, LIME, r=3)
48
+ + rect(-4, -62, 8, 34, _STEEL)
49
+ + rect(-4, -62, 3, 34, _STEEL_DARK)
50
+ + rect(-6, -40, 12, 5, _STEEL_DARK, r=2)
51
+ + path("M-3 -62L3 -62L1 -84L-1 -84Z", _STEEL_LIGHT)
52
+ + circle(0, -84, 2.6, 0xFFB26B)
53
+ + at(0, -88, _smoke(turn))
54
+ )
55
+
56
+
57
+ def wire(turn=0):
58
+ """A jumper wire, held by its housing, pin up."""
59
+ return (
60
+ path("M0 14C2 44 -34 40 -30 72C-27 94 -52 96 -58 112", None, LIME, 6.5)
61
+ + path("M0 14C2 44 -34 40 -30 72", None, 0xE4F5A8, 1.8, opacity=0.8)
62
+ + rect(-2, -52, 4, 30, _STEEL_LIGHT, r=1.5)
63
+ + rect(-2, -52, 1.6, 30, _STEEL_DARK)
64
+ + rect(-7.5, -24, 15, 40, _INK, r=3)
65
+ + rect(2, -20, 3, 32, 0x55555F, r=1.5)
66
+ )
67
+
68
+
69
+ def screwdriver(turn=0):
70
+ """A small screwdriver with a fat handle."""
71
+ return (
72
+ rect(-3, -78, 6, 52, _STEEL, r=1)
73
+ + rect(-3, -78, 2.4, 52, _STEEL_DARK)
74
+ + path("M-3 -78L3 -78L5 -90L-5 -90Z", _STEEL_LIGHT)
75
+ + rect(-10, -30, 20, 56, _RED, r=9)
76
+ + rect(-10, -30, 7, 56, _RED_DARK, r=4)
77
+ + rect(4, -20, 3, 34, 0xFF8A70, r=1.5)
78
+ + rect(-10, -22, 20, 5, _INK, opacity=0.35)
79
+ )
80
+
81
+
82
+ def magnifier(turn=0):
83
+ """A magnifying glass: what's behind the lens shows through it."""
84
+ return (
85
+ rect(-6, -14, 12, 48, _INK, r=5)
86
+ + rect(1, -8, 3, 34, 0x55555F, r=1.5)
87
+ + rect(-5, -24, 10, 12, _GOLD_DARK, r=2)
88
+ + circle(0, -60, 36, 0xBFE9FF, opacity=0.30)
89
+ + circle(0, -60, 36, None, _GOLD_DARK, 9)
90
+ + circle(0, -60, 37.5, None, _GOLD, 5)
91
+ + path("M-22 -66A24 24 0 0 1 -6 -83", None, WHITE, 5, opacity=0.85)
92
+ + circle(-24, -55, 2.6, WHITE, opacity=0.85)
93
+ )
94
+
95
+
96
+ def pencil(turn=0):
97
+ """A pencil, sharpened."""
98
+ return (
99
+ rect(-6, -62, 12, 86, _GOLD)
100
+ + rect(-6, -62, 4.5, 86, _GOLD_DARK)
101
+ + rect(3, -62, 3, 86, 0xFFD778)
102
+ + path("M-6 -62L6 -62L0 -84Z", _WOOD)
103
+ + path("M-6 -62L-1.5 -62L0 -84Z", _WOOD_DARK)
104
+ + path("M-2.2 -76L2.2 -76L0 -84Z", _INK)
105
+ + rect(-6, 22, 12, 7, _STEEL)
106
+ + rect(-6, 22, 12, 2.2, _STEEL_DARK)
107
+ + rect(-6, 28, 12, 11, 0xFF8FA3, r=4)
108
+ )
109
+
110
+
111
+ def board(turn=0):
112
+ """A small microcontroller board, held by its edge, its light on."""
113
+ out = [
114
+ rect(-34, -98, 68, 100, 0x0E3B66, r=6),
115
+ rect(-34, -98, 68, 100, None, 6, 0x1D5C96, 2),
116
+ # the USB socket at the top, the chip, the header pads down each side
117
+ rect(-11, -106, 22, 18, _STEEL, r=2),
118
+ rect(-11, -106, 22, 5, _STEEL_LIGHT, r=2),
119
+ rect(-15, -66, 30, 30, _INK, r=2),
120
+ circle(-9, -60, 2, 0x6A6A75),
121
+ path("M-22 -24L-22 -14L-8 -14", None, LIME, 1.8),
122
+ path("M22 -30L22 -78L16 -78", None, LIME, 1.8),
123
+ ]
124
+ for i in range(7):
125
+ y = -86 + i * 12.5
126
+ out.append(rect(-31, y, 6, 6, _GOLD, r=1))
127
+ out.append(rect(25, y, 6, 6, _GOLD, r=1))
128
+ for i in range(4):
129
+ out.append(rect(-19, -62 + i * 7, 4, 2.4, _STEEL))
130
+ out.append(rect(15, -62 + i * 7, 4, 2.4, _STEEL))
131
+ out.append(circle(10, -22, 13, LIME, opacity=0.22))
132
+ out.append(circle(10, -22, 8, LIME, opacity=0.35))
133
+ out.append(rect(5, -25, 10, 6, 0xF6FFC4, r=1.5))
134
+ return b"".join(out)
135
+
136
+
137
+ def lantern(turn=0, color=LIME):
138
+ """A lit LED carried by its legs, like a lantern."""
139
+ return (
140
+ circle(0, -74, 62, color, opacity=0.10)
141
+ + circle(0, -74, 46, color, opacity=0.14)
142
+ + circle(0, -74, 33, color, opacity=0.20)
143
+ + line(-7, -44, -7, 26, _STEEL, 3.2)
144
+ + line(7, -44, 7, 14, _STEEL, 3.2)
145
+ + path("M-20 -72A20 20 0 0 1 20 -72L20 -50L-20 -50Z", color)
146
+ + path("M-20 -72A20 20 0 0 1 -6 -91L-6 -50L-20 -50Z", 0x000000, opacity=0.14)
147
+ + rect(-24, -52, 48, 8, color, r=2)
148
+ + rect(-24, -47, 48, 3, 0x000000, opacity=0.18)
149
+ + path(pts([(-9, -52), (-9, -72), (-2, -72), (-2, -62), (2, -66), (9, -66), (9, -52)], True), 0x000000, opacity=0.20)
150
+ + path("M8 -84A14 14 0 0 1 14 -72", None, WHITE, 4, opacity=0.9)
151
+ + circle(1, -76, 8, 0xFDFFE0, opacity=0.9)
152
+ )
153
+
154
+
155
+ def probe(turn=0):
156
+ """A multimeter probe on its lead."""
157
+ return (
158
+ path("M0 26C-4 56 28 54 22 82C18 100 36 106 40 118", None, _RED_DARK, 5)
159
+ + rect(-1.6, -86, 3.2, 34, _STEEL_LIGHT)
160
+ + path("M-1.6 -86L1.6 -86L0 -94Z", _STEEL_LIGHT)
161
+ + path("M-5 -54L5 -54L8 -32L-8 -32Z", _RED)
162
+ + rect(-11, -34, 22, 6, _RED_DARK, r=3)
163
+ + rect(-8, -30, 16, 58, _RED, r=7)
164
+ + rect(-8, -30, 5.5, 58, _RED_DARK, r=3)
165
+ + rect(3, -22, 2.6, 40, 0xFF8A70, r=1.3)
166
+ )
167
+
168
+
169
+ def mug(turn=0):
170
+ """A mug of something hot, held by its handle."""
171
+ return (
172
+ path("M8 -18A17 17 0 1 0 8 14", None, _CREAM, 8)
173
+ + path("M8 -18A17 17 0 1 0 8 14", None, 0xD9CDB4, 2.5)
174
+ + rect(4, -34, 52, 60, _CREAM, r=8)
175
+ + rect(4, -34, 15, 60, 0xD9CDB4, r=7)
176
+ + rect(4, -12, 52, 9, 0x1C6E8C)
177
+ + rect(4, -1, 52, 4, LIME)
178
+ + ellipse(30, -33, 23, 5.5, 0x6B4226)
179
+ + ellipse(34, -33, 12, 2.4, 0x94603A)
180
+ + at(30, -42, _smoke(turn))
181
+ )
182
+
183
+
184
+ def umbrella(turn=0):
185
+ """An umbrella, open."""
186
+ out = [
187
+ line(0, -96, 0, 22, _INK, 4),
188
+ path("M0 22Q0 34 -9 34Q-17 34 -17 25", None, _INK, 4),
189
+ path("M-70 -92Q0 -168 70 -92Q52 -104 35 -92Q17 -104 0 -92Q-17 -104 -35 -92Q-52 -104 -70 -92Z", _RED),
190
+ path("M-35 -92Q-30 -140 0 -129Q-17 -104 -35 -92Z", 0xFFF1D6),
191
+ path("M35 -92Q30 -140 0 -129Q17 -104 35 -92Z", 0xFFF1D6),
192
+ path("M-70 -92Q-52 -122 0 -129Q-30 -140 -35 -92Q-52 -104 -70 -92Z", _RED_DARK),
193
+ path("M22 -122Q44 -112 54 -98", None, 0xFF8A70, 3.5),
194
+ line(0, -129, 0, -140, _INK, 4),
195
+ ]
196
+ return b"".join(out)
197
+
198
+
199
+ def leaf(turn=0):
200
+ """A broad leaf on its stalk, as good as a parasol."""
201
+ return (
202
+ path("M0 26Q-4 0 2 -30", None, 0x3F7D32, 5)
203
+ + path("M2 -30C-52 -44 -58 -104 2 -132C62 -104 56 -44 2 -30Z", 0x6FC24B)
204
+ + path("M2 -30C-52 -44 -58 -104 2 -132C-18 -96 -14 -58 2 -30Z", 0x4A9E3F)
205
+ + path("M2 -34L2 -122M2 -56L-24 -76M2 -56L30 -74M2 -84L-18 -100M2 -84L24 -100", None, 0x2F7A36, 2.4)
206
+ + path("M26 -52Q44 -74 30 -104", None, 0xB8EB7A, 3.5)
207
+ )
208
+
209
+
210
+ def flower(turn=0):
211
+ """A daisy."""
212
+ out = [path("M0 26Q6 -8 0 -48", None, 0x3F7D32, 4.5), path("M2 -6C16 -20 34 -16 38 -4C24 4 10 4 2 -6Z", 0x5E9E3E)]
213
+ for i in range(9):
214
+ out.append(group(ellipse(0, -21, 8.5, 15, WHITE if i % 2 else 0xF1E9F7), "translate(0 -62) rotate(%d)" % (i * 40)))
215
+ out.append(circle(0, -62, 12, _GOLD))
216
+ out.append(circle(3, -65, 5.5, 0xFFD778))
217
+ return b"".join(out)
218
+
219
+
220
+ def plane(turn=0):
221
+ """A paper aeroplane, pinched by its keel, ready to throw."""
222
+ return (
223
+ path(pts([(-4, 6), (4, -96), (10, 2)], True), 0xC9D6E4)
224
+ + path(pts([(4, -96), (-44, 14), (-4, 6)], True), WHITE)
225
+ + path(pts([(4, -96), (46, 4), (10, 2)], True), 0xE6EDF5)
226
+ + path(pts([(4, -96), (-4, 6), (2, 26), (10, 2)], True), 0xA9BACD)
227
+ + line(4, -96, 2, 26, 0x8A9BB0, 1.2)
228
+ )
229
+
230
+
231
+ def flag(turn=0):
232
+ """A pennant on a stick, with a spiral for its mark."""
233
+ spiral = []
234
+ for i in range(26):
235
+ a = i * 0.42
236
+ r = 2 + i * 0.52
237
+ spiral.append((27 + math.cos(a) * r, -98 + math.sin(a) * r))
238
+ return (
239
+ rect(-3, -128, 6, 156, _WOOD, r=3)
240
+ + rect(-3, -128, 2.4, 156, _WOOD_DARK, r=1.2)
241
+ + circle(0, -130, 5.5, _GOLD)
242
+ + path("M3 -124Q32 -132 62 -120Q44 -100 64 -78Q32 -66 3 -74Z", LIME)
243
+ + path("M3 -84Q32 -76 62 -88L64 -78Q32 -66 3 -74Z", 0x9DB93A)
244
+ + path(smooth(spiral), None, NAVY, 3.6)
245
+ )
246
+
247
+
248
+ def wrench(turn=0):
249
+ """An open-ended spanner."""
250
+ return (
251
+ rect(-7, -64, 14, 92, _STEEL, r=6)
252
+ + rect(-7, -64, 5, 92, _STEEL_DARK, r=2.5)
253
+ + rect(3, -54, 2.6, 70, _STEEL_LIGHT, r=1.3)
254
+ + circle(0, 20, 3.4, NAVY)
255
+ + path("M-9 -58A20 20 0 1 1 9 -58Z", _STEEL)
256
+ + path("M-9 -58A20 20 0 0 1 -18 -84L-8 -78Z", _STEEL_DARK)
257
+ + path(pts([(-8, -100), (-8, -78), (8, -78), (8, -100)], True), NAVY)
258
+ )
259
+
260
+
261
+ def sparkler(turn=0):
262
+ """A sparkler, lit."""
263
+ out = [line(0, 26, 0, -70, _STEEL_DARK, 2.6), line(0, -40, 0, -70, 0x6A6A75, 4.5)]
264
+ out.append(circle(0, -78, 44, _GOLD, opacity=0.12))
265
+ out.append(circle(0, -78, 28, 0xFFE9A8, opacity=0.2))
266
+ for i in range(12):
267
+ a = math.radians(i * 30 + 8)
268
+ r1 = 40 if i % 2 else 27
269
+ out.append(line(math.cos(a) * 9, -78 + math.sin(a) * 9, math.cos(a) * r1, -78 + math.sin(a) * r1, 0xFFE9A8 if i % 2 else _GOLD, 2.6))
270
+ if i % 2:
271
+ out.append(circle(math.cos(a) * (r1 + 8), -78 + math.sin(a) * (r1 + 8), 2.4, WHITE))
272
+ else:
273
+ out.append(circle(math.cos(a + 0.3) * (r1 + 12), -78 + math.sin(a + 0.3) * (r1 + 12), 1.8, _GOLD))
274
+ out.append(circle(0, -78, 8, WHITE))
275
+ return b"".join(out)
276
+
277
+
278
+ def balloon(turn=0):
279
+ """A balloon on its string."""
280
+ return (
281
+ path("M0 26C-6 -4 8 -30 0 -62", None, _STEEL_LIGHT, 1.8)
282
+ + path("M-6 -60L6 -60L0 -70Z", _RED_DARK)
283
+ + ellipse(0, -112, 38, 46, _RED)
284
+ + path("M0 -66C-30 -70 -44 -110 -30 -140C-24 -106 -16 -84 0 -66Z", _RED_DARK)
285
+ + ellipse(14, -130, 9, 15, 0xFF9C88, rot=24)
286
+ + circle(22, -106, 3.4, 0xFF9C88)
287
+ )
288
+
289
+
290
+ # name -> (the prop, how far it leans from upright in degrees, or None to lie along the hand)
291
+ PROPS = {
292
+ "iron": (iron, None),
293
+ "wire": (wire, None),
294
+ "screwdriver": (screwdriver, None),
295
+ "magnifier": (magnifier, None),
296
+ "pencil": (pencil, None),
297
+ "board": (board, None),
298
+ "lantern": (lantern, 30),
299
+ "probe": (probe, None),
300
+ "mug": (mug, 0),
301
+ "umbrella": (umbrella, 12),
302
+ "leaf": (leaf, 22),
303
+ "flower": (flower, None),
304
+ "plane": (plane, None),
305
+ "flag": (flag, 30),
306
+ "wrench": (wrench, None),
307
+ "sparkler": (sparkler, None),
308
+ "balloon": (balloon, 28),
309
+ }
310
+ ORDER = ("iron", "screwdriver", "wrench", "probe", "wire", "board", "magnifier", "pencil", "lantern", "sparkler", "mug", "flag", "umbrella", "leaf", "flower", "balloon", "plane")
311
+
312
+ # each prop's own box, (left, top, right, bottom), for laying out the sheet
313
+ _BOX = {
314
+ "iron": (-12, -160, 18, 62),
315
+ "screwdriver": (-10, -90, 10, 26),
316
+ "wrench": (-20, -100, 20, 28),
317
+ "probe": (-11, -94, 42, 118),
318
+ "wire": (-60, -52, 8, 114),
319
+ "board": (-37, -106, 37, 5),
320
+ "magnifier": (-42, -100, 42, 34),
321
+ "pencil": (-6, -84, 6, 39),
322
+ "lantern": (-62, -136, 62, 26),
323
+ "sparkler": (-54, -132, 54, 26),
324
+ "mug": (-13, -112, 56, 26),
325
+ "flag": (-6, -136, 64, 28),
326
+ "umbrella": (-70, -140, 70, 34),
327
+ "leaf": (-44, -132, 48, 26),
328
+ "flower": (-24, -98, 38, 26),
329
+ "balloon": (-38, -158, 38, 26),
330
+ "plane": (-44, -96, 46, 26),
331
+ }
332
+
333
+
334
+ def party_hat():
335
+ """A party hat, its point up and its brim at the origin."""
336
+ return (
337
+ path(pts([(-22, 0), (0, -58), (22, 0)], True), LIME)
338
+ + path(pts([(-22, 0), (0, -58), (-4, 0)], True), 0x9DB93A)
339
+ + path("M-13 -24L14 -20L16 -14L-16 -17Z", 0x1C6E8C)
340
+ + path("M-6 -42L7 -40L9 -34L-9 -36Z", _RED)
341
+ + path("M-22 0Q0 8 22 0", None, WHITE, 6)
342
+ + circle(0, -60, 8, WHITE)
343
+ + circle(2, -62, 3.4, 0xF1F5F9)
344
+ )
345
+
346
+
347
+ def _fist(skin, shade, deep):
348
+ # three toes wrapped across a handle, the knuckle of the thumb side below them
349
+ return (
350
+ ellipse(0, -8, 17, 15, shade)
351
+ + limb(-15, -19, 15, -20, 0.05, 11, 10, skin)
352
+ + limb(-16, -10, 16, -11, 0.05, 12, 11, skin)
353
+ + limb(-14, -1, 14, -2, 0.05, 11, 10, skin)
354
+ + path("M-15 -14.5Q0 -13 15 -15.5M-15 -5.5Q0 -4 14 -6.5", None, deep, 1.8)
355
+ + path("M-9 -22.5Q0 -24 8 -23", None, shade, 1.6, opacity=0.7)
356
+ )
357
+
358
+
359
+ def hold(doc, prop, wear=None, lean=None, size=1.25, **pose):
360
+ """The chameleon with one hand raised and *prop* in it.
361
+
362
+ Args:
363
+ doc: The `vec.Doc` that holds the gradients.
364
+ prop (str): A name from `PROPS`, or None for an empty hand.
365
+ wear (str): "party_hat", or None.
366
+ lean (float): The prop's turn in degrees, or None for its usual one.
367
+ size (float): The prop's size.
368
+ pose: Arguments for `huey.draw`: look, mood, colors, perch.
369
+ """
370
+ pose.setdefault("hand", 1)
371
+ colors = huey.COLORS[pose.get("colors", "leaf")]
372
+ skin, shade, deep = colors[0], colors[1], colors[5]
373
+ out = [huey.draw(doc, **pose)]
374
+ if wear == "party_hat":
375
+ out.append(at(84, -214, party_hat(), rot=-14))
376
+ if prop:
377
+ x, y, turn = huey.grip(pose["hand"])
378
+ shape, own = PROPS[prop]
379
+ if lean is None:
380
+ lean = turn if own is None else own
381
+ # the toes close a little up the hand, round the low end of the handle
382
+ gx = x + math.sin(math.radians(turn)) * 9 + math.sin(math.radians(lean)) * 10 * size
383
+ gy = y - math.cos(math.radians(turn)) * 9 - math.cos(math.radians(lean)) * 10 * size
384
+ out.append(at(gx, gy, shape(lean), rot=lean, scale=size))
385
+ out.append(at(x, y, _fist(skin, shade, deep), rot=turn))
386
+ return b"".join(out)
@@ -0,0 +1,42 @@
1
+ # SPDX-FileCopyrightText: 2026 Brad Barnett
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """The chameleon's colour change: more colour schemes, and any blend of two.
5
+
6
+ `between` gives the scheme part of the way from one to another, so a change
7
+ of colour is a handful of redraws. Each scheme here comes with the ground it
8
+ was made for.
9
+ """
10
+
11
+ from .huey import COLORS
12
+ from .vec import mix
13
+
14
+ # More schemes, in huey's order: skin, shade, light, belly, spots, deep.
15
+ COLORS.update(
16
+ {
17
+ "blossom": (0xF59AB8, 0xD0668F, 0xFFC7D8, 0xFFF1E0, 0xFFFFFE, 0x9A3D68),
18
+ "snow": (0xDCEBF5, 0xA9C6DC, 0xFFFFFE, 0xFEFFFF, 0x7FB2D9, 0x6E93B5),
19
+ "night": (0x3B3F8F, 0x272A6B, 0x6A70C9, 0xC4DC4D, 0xE8FF8A, 0x171A4A),
20
+ "copper": (0xD98A4E, 0xA8602F, 0xF4B77E, 0xFBE3B5, 0x2F7F7A, 0x6E3B1C),
21
+ }
22
+ )
23
+
24
+ # The ground each scheme sits on in the stills.
25
+ GROUNDS = {
26
+ "leaf": 0x1F4D3A,
27
+ "brand": 0x0B2A4A,
28
+ "sunset": 0x5A2A5E,
29
+ "board": 0x0E3B3A,
30
+ "blossom": 0x6FBDE8,
31
+ "snow": 0x7C9CC0,
32
+ "night": 0x06122A,
33
+ "copper": 0x3A2A22,
34
+ }
35
+
36
+
37
+
38
+ def between(a, b, t):
39
+ """Register and return the name of the scheme *t* of the way from *a* to *b*."""
40
+ name = "%s>%s@%d" % (a, b, int(t * 100))
41
+ COLORS[name] = tuple(mix(x, y, t) for x, y in zip(COLORS[a], COLORS[b]))
42
+ return name