@africode/core 5.0.10 → 5.0.13

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 (222) hide show
  1. package/AGENTS.md +585 -585
  2. package/AGENT_INSTRUCTIONS.md +595 -595
  3. package/COMPONENT_SCHEMA.json +1826 -1800
  4. package/LICENSE +623 -623
  5. package/README.md +476 -476
  6. package/bin/africode.js +73 -73
  7. package/bin/cli.ts +82 -82
  8. package/bin/create-africode.js +220 -220
  9. package/bin/scaffold.ts +218 -218
  10. package/components/accordion.js +183 -183
  11. package/components/alert.js +131 -131
  12. package/components/auth-form.js +154 -154
  13. package/components/auth.js +172 -172
  14. package/components/avatar.js +117 -117
  15. package/components/badge.js +104 -104
  16. package/components/base.d.ts +139 -139
  17. package/components/base.js +234 -234
  18. package/components/breadcrumb.js +76 -72
  19. package/components/button.js +164 -164
  20. package/components/card.js +144 -137
  21. package/components/carousel.js +32 -32
  22. package/components/cart-drawer.js +28 -28
  23. package/components/code-block.js +20 -20
  24. package/components/contact-form.js +25 -25
  25. package/components/cookie-consent.js +23 -23
  26. package/components/cta-banner.js +38 -38
  27. package/components/cultural-card.js +243 -243
  28. package/components/dashboard-activity-list.js +103 -103
  29. package/components/dashboard-card.js +85 -85
  30. package/components/dashboard-metric.js +81 -81
  31. package/components/dashboard-shell.js +85 -85
  32. package/components/dashboard-topbar.js +84 -84
  33. package/components/divider.js +83 -83
  34. package/components/dropdown.js +171 -171
  35. package/components/error-boundary.js +155 -155
  36. package/components/faq-accordion.js +23 -23
  37. package/components/feature-grid.js +85 -85
  38. package/components/file-uploader.js +22 -22
  39. package/components/filter-bar.js +19 -19
  40. package/components/footer.js +113 -113
  41. package/components/form.js +131 -131
  42. package/components/gallery.js +22 -22
  43. package/components/hero.js +140 -138
  44. package/components/icon.js +36 -36
  45. package/components/index.js +128 -128
  46. package/components/input.js +252 -256
  47. package/components/kanga-card.js +185 -185
  48. package/components/kyc-upload.js +173 -173
  49. package/components/language-switcher.js +108 -108
  50. package/components/loader.js +80 -80
  51. package/components/modal.js +262 -262
  52. package/components/motion.js +84 -84
  53. package/components/nav-drawer.js +216 -216
  54. package/components/navbar.js +243 -236
  55. package/components/newsletter-signup.js +24 -24
  56. package/components/pagination.js +31 -31
  57. package/components/pattern-showcase.js +225 -225
  58. package/components/pricing-card.js +100 -100
  59. package/components/product-card.js +41 -41
  60. package/components/progress.js +132 -134
  61. package/components/react.js +111 -111
  62. package/components/search-box.js +24 -24
  63. package/components/section.js +54 -54
  64. package/components/select.js +321 -322
  65. package/components/sidebar.js +180 -180
  66. package/components/simple-chart.js +22 -22
  67. package/components/skeleton.js +85 -85
  68. package/components/stepper.js +28 -28
  69. package/components/table.js +181 -181
  70. package/components/tabs.js +202 -202
  71. package/components/team-grid.js +23 -23
  72. package/components/testimonial.js +94 -94
  73. package/components/theme-toggle.js +82 -82
  74. package/components/toast.js +139 -139
  75. package/components/tooltip.js +167 -167
  76. package/components/transaction-ledger.js +138 -138
  77. package/components/ui-avatar.js +79 -79
  78. package/components/ui-badge.js +61 -61
  79. package/components/ui-button.js +149 -149
  80. package/components/ui-card.js +74 -75
  81. package/components/ui-chip.js +87 -87
  82. package/components/ui-input.js +110 -110
  83. package/components/ui-popover.js +84 -84
  84. package/components/ui-progress-ring.js +60 -60
  85. package/components/ui-select.js +85 -85
  86. package/components/ui-stat.js +75 -75
  87. package/components/ui-switch.js +85 -85
  88. package/components/ui-table.js +69 -69
  89. package/components/ui-tabs.js +99 -99
  90. package/components/ui-tag.js +64 -64
  91. package/components/ui-textarea.js +84 -84
  92. package/components/ui-tooltip.js +66 -66
  93. package/components/video-player.js +22 -22
  94. package/components/wallet-balance.js +114 -114
  95. package/core/a2ui-schema-manager.js +351 -351
  96. package/core/a2ui.js +696 -696
  97. package/core/actions.js +27 -27
  98. package/core/bun-runtime.js +398 -397
  99. package/core/cli/commands/add.js +23 -23
  100. package/core/cli/commands/audit.js +58 -58
  101. package/core/cli/commands/build.js +193 -193
  102. package/core/cli/commands/create-plugin.js +241 -241
  103. package/core/cli/commands/dev.js +252 -285
  104. package/core/cli/commands/lint.js +23 -23
  105. package/core/cli/commands/test.js +33 -34
  106. package/core/cli/migrator.js +71 -71
  107. package/core/cli/ui.js +56 -56
  108. package/core/compliance.js +823 -823
  109. package/core/config.js +265 -265
  110. package/core/db-advanced.js +478 -481
  111. package/core/db.js +282 -284
  112. package/core/enhanced-hmr.js +406 -406
  113. package/core/errors.js +222 -222
  114. package/core/file-router.js +52 -50
  115. package/core/hmr-client.js +203 -204
  116. package/core/hmr.js +205 -197
  117. package/core/html.d.ts +30 -30
  118. package/core/html.js +84 -84
  119. package/core/hydration.js +52 -52
  120. package/core/lipa-namba-journey.js +548 -605
  121. package/core/logging.js +14 -14
  122. package/core/middleware.js +145 -145
  123. package/core/motion.js +106 -106
  124. package/core/nida-cig-middleware.js +417 -460
  125. package/core/patterns.d.ts +124 -124
  126. package/core/patterns.js +947 -1001
  127. package/core/plugins/index.js +345 -345
  128. package/core/request-analytics.js +253 -253
  129. package/core/request-identity.js +93 -93
  130. package/core/router.js +386 -386
  131. package/core/sdk-browser.js +140 -140
  132. package/core/sdk-client.js +61 -61
  133. package/core/sdk.d.ts +133 -133
  134. package/core/sdk.js +148 -148
  135. package/core/seo.js +76 -76
  136. package/core/server/auth-endpoints.js +339 -339
  137. package/core/server/auth.js +180 -180
  138. package/core/server/csrf.js +200 -206
  139. package/core/server/db.js +39 -39
  140. package/core/server/middleware.js +324 -324
  141. package/core/server/rate-limit.js +238 -238
  142. package/core/server/render.js +67 -69
  143. package/core/server/router.js +102 -120
  144. package/core/session-store.js +68 -68
  145. package/core/shim.js +28 -28
  146. package/core/state.d.ts +86 -86
  147. package/core/state.js +276 -276
  148. package/core/store.d.ts +122 -122
  149. package/core/store.js +61 -61
  150. package/core/validation.d.ts +232 -232
  151. package/core/validation.js +602 -602
  152. package/core/websocket.js +656 -641
  153. package/dist/africode.js +233 -230
  154. package/dist/africode.js.map +83 -83
  155. package/dist/build-info.json +3 -3
  156. package/dist/components.js +195 -192
  157. package/dist/components.js.map +73 -73
  158. package/dist/styles/africanity.css +321 -321
  159. package/dist/styles/typography.css +140 -140
  160. package/docs/IDE-Guide.md +50 -50
  161. package/package.json +113 -113
  162. package/scripts/generate-component-schema.js +82 -79
  163. package/styles/africanity.css +321 -321
  164. package/styles/typography.css +140 -140
  165. package/templates/starter/.env.example +15 -15
  166. package/templates/starter/africode.config.js +40 -40
  167. package/templates/starter/package.json +13 -13
  168. package/templates/starter/src/index.js +18 -18
  169. package/templates/starter/src/pages/index.html +55 -55
  170. package/templates/starter/src/pages/index.js +17 -17
  171. package/templates/starter/src/styles/main.css +3 -3
  172. package/templates/starter-3d/.env.example +7 -7
  173. package/templates/starter-3d/africode.config.js +29 -29
  174. package/templates/starter-3d/components/af-model-viewer.js +125 -125
  175. package/templates/starter-3d/package.json +14 -14
  176. package/templates/starter-3d/src/pages/index.html +55 -55
  177. package/templates/starter-3d/src/pages/index.js +50 -50
  178. package/templates/starter-3d/src/styles/main.css +3 -3
  179. package/templates/starter-dashboard/.env.example +21 -21
  180. package/templates/starter-dashboard/africode.config.js +20 -20
  181. package/templates/starter-dashboard/package.json +14 -14
  182. package/templates/starter-dashboard/src/index.js +17 -17
  183. package/templates/starter-dashboard/src/pages/api/analytics.js +24 -24
  184. package/templates/starter-dashboard/src/pages/index.html +118 -118
  185. package/templates/starter-dashboard/src/pages/index.js +110 -110
  186. package/templates/starter-dashboard/src/styles/main.css +172 -172
  187. package/templates/starter-fintech/.env.example +28 -28
  188. package/templates/starter-fintech/africode.config.js +20 -20
  189. package/templates/starter-fintech/package.json +15 -15
  190. package/templates/starter-fintech/src/index.js +17 -17
  191. package/templates/starter-fintech/src/pages/api/auth.js +45 -45
  192. package/templates/starter-fintech/src/pages/api/dashboard.js +19 -0
  193. package/templates/starter-fintech/src/pages/api/transfer.js +65 -65
  194. package/templates/starter-fintech/src/pages/api/wallet.js +39 -39
  195. package/templates/starter-fintech/src/pages/api/webhooks/payment.js +32 -32
  196. package/templates/starter-fintech/src/pages/index.html +169 -169
  197. package/templates/starter-fintech/src/pages/index.js +161 -161
  198. package/templates/starter-fintech/src/styles/main.css +246 -246
  199. package/templates/starter-react/.env.example +15 -15
  200. package/templates/starter-react/africode.config.js +40 -40
  201. package/templates/starter-react/package.json +15 -15
  202. package/templates/starter-react/src/pages/index.html +55 -55
  203. package/templates/starter-react/src/pages/index.js +68 -68
  204. package/templates/starter-react/src/styles/main.css +3 -3
  205. package/templates/starter-tailwind/.env.example +15 -15
  206. package/templates/starter-tailwind/africode.config.js +40 -40
  207. package/templates/starter-tailwind/package.json +19 -19
  208. package/templates/starter-tailwind/src/pages/index.html +55 -55
  209. package/templates/starter-tailwind/src/pages/index.js +67 -67
  210. package/templates/starter-tailwind/src/styles/main.css +3 -3
  211. package/templates/starter-tailwind/src/styles/tailwind.css +1 -1
  212. package/templates/starter-tailwind/src/tailwind-loader.js +30 -30
  213. package/templates/starter-tailwind/tailwind.config.cjs +18 -18
  214. package/templates/starter-website/.env.example +18 -18
  215. package/templates/starter-website/africode.config.js +20 -20
  216. package/templates/starter-website/package.json +14 -14
  217. package/templates/starter-website/src/index.js +17 -17
  218. package/templates/starter-website/src/pages/index.html +124 -124
  219. package/templates/starter-website/src/pages/index.js +116 -116
  220. package/templates/starter-website/src/styles/main.css +195 -195
  221. package/bin/africode.js.1758507140 +0 -343
  222. package/core/heartbeat.js +0 -64
package/core/patterns.js CHANGED
@@ -1,1001 +1,947 @@
1
- /**
2
- * AfriCode Procedural SVG Pattern Engine
3
- *
4
- * Generates lightweight, on-the-fly SVG patterns inspired by
5
- * African textiles from across the continent:
6
- *
7
- * EAST AFRICA: Maasai Shuka, Kanga, Kitenge, Hadzabe
8
- * WEST AFRICA: Ghana Kente, Adinkra, Nigeria Aso-Oke, Ankara
9
- * SOUTHERN AFRICA: Ndebele, Zulu, Swazi/Eswatini, Xhosa
10
- *
11
- * @module core/patterns
12
- */
13
-
14
- /**
15
- * Generate a polygon with n sides
16
- * Based on the mathematical formula:
17
- * x_i = cx + r * cos(2πi/n)
18
- * y_i = cy + r * sin(2πi/n)
19
- */
20
- export function generatePolygon(n, r, cx = 50, cy = 50) {
21
- const points = [];
22
- for (let i = 0; i < n; i++) {
23
- const angle = (2 * Math.PI * i) / n - Math.PI / 2;
24
- const x = cx + r * Math.cos(angle);
25
- const y = cy + r * Math.sin(angle);
26
- points.push(`${x.toFixed(2)},${y.toFixed(2)}`);
27
- }
28
- return points.join(' ');
29
- }
30
-
31
- // ============================================
32
- // EAST AFRICAN PATTERNS
33
- // ============================================
34
-
35
- /**
36
- * Generate Maasai Shuka tartan pattern (Tanzania/Kenya)
37
- * Traditional red checkered blanket with overlapping stripes
38
- */
39
- export function generateShuka({
40
- primaryColor = '#FF0000',
41
- secondaryColor = '#000000',
42
- backgroundColor = '#8B0000',
43
- stripeWidth = 4,
44
- size = 40
45
- } = {}) {
46
- const svg = `
47
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
48
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
49
- <rect x="0" y="0" width="${size}" height="${stripeWidth}" fill="${primaryColor}" opacity="0.8"/>
50
- <rect x="0" y="${size / 2 - stripeWidth / 2}" width="${size}" height="${stripeWidth}" fill="${secondaryColor}" opacity="0.6"/>
51
- <rect x="0" y="${size - stripeWidth}" width="${size}" height="${stripeWidth}" fill="${primaryColor}" opacity="0.8"/>
52
- <rect x="0" y="0" width="${stripeWidth}" height="${size}" fill="${primaryColor}" opacity="0.5"/>
53
- <rect x="${size / 2 - stripeWidth / 2}" y="0" width="${stripeWidth}" height="${size}" fill="${secondaryColor}" opacity="0.4"/>
54
- <rect x="${size - stripeWidth}" y="0" width="${stripeWidth}" height="${size}" fill="${primaryColor}" opacity="0.5"/>
55
- </svg>
56
- `;
57
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
58
- }
59
-
60
- /**
61
- * Generate Hadzabe pattern (Tanzania)
62
- * Inspired by cave paintings and natural earth tones
63
- * Hunter-gatherer tribe with ancient artistic traditions
64
- */
65
- export function generateHadzabe({
66
- earthColor = '#8B4513',
67
- ochreColor = '#CD853F',
68
- charcoalColor = '#2F2F2F',
69
- size = 50
70
- } = {}) {
71
- const svg = `
72
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
73
- <rect width="${size}" height="${size}" fill="${earthColor}"/>
74
- <!-- Cave art inspired figures -->
75
- <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.08}" fill="${ochreColor}"/>
76
- <line x1="${size * 0.3}" y1="${size * 0.38}" x2="${size * 0.3}" y2="${size * 0.6}" stroke="${charcoalColor}" stroke-width="2"/>
77
- <line x1="${size * 0.2}" y1="${size * 0.45}" x2="${size * 0.4}" y2="${size * 0.45}" stroke="${charcoalColor}" stroke-width="2"/>
78
- <!-- Animal figure -->
79
- <ellipse cx="${size * 0.7}" cy="${size * 0.5}" rx="${size * 0.15}" ry="${size * 0.08}" fill="${ochreColor}"/>
80
- <line x1="${size * 0.6}" y1="${size * 0.58}" x2="${size * 0.6}" y2="${size * 0.7}" stroke="${charcoalColor}" stroke-width="2"/>
81
- <line x1="${size * 0.8}" y1="${size * 0.58}" x2="${size * 0.8}" y2="${size * 0.7}" stroke="${charcoalColor}" stroke-width="2"/>
82
- <!-- Dots like ancient markings -->
83
- <circle cx="${size * 0.15}" cy="${size * 0.8}" r="3" fill="${ochreColor}"/>
84
- <circle cx="${size * 0.85}" cy="${size * 0.2}" r="3" fill="${ochreColor}"/>
85
- </svg>
86
- `;
87
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
88
- }
89
-
90
- /**
91
- * Generate Kanga border pattern (Tanzania/Kenya)
92
- */
93
- export function generateKangaBorder({
94
- primaryColor = '#1EB53A', // Simple Green (Tanzania)
95
- accentColor = '#FCD116', // Gold
96
- size = 30
97
- } = {}) {
98
- const svg = `
99
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
100
- <rect width="${size}" height="${size}" fill="${primaryColor}"/>
101
- <!-- Pindo (Border) Motifs: Cashew/Triangle -->
102
- <path d="M0,0 L${size / 2},${size / 2} L0,${size} Z" fill="${accentColor}"/>
103
- <path d="M${size},0 L${size / 2},${size / 2} L${size},${size} Z" fill="${accentColor}"/>
104
- <circle cx="${size / 2}" cy="${size / 2}" r="${size * 0.15}" fill="none" stroke="${accentColor}" stroke-width="2"/>
105
- </svg>
106
- `;
107
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
108
- }
109
-
110
- /**
111
- * Generate Kanga traditional Swahili cloth pattern (East Africa)
112
- */
113
- export function generateKanga({
114
- primaryColor = '#FF6B00',
115
- secondaryColor = '#002B5C',
116
- backgroundColor = '#FFFFFF',
117
- size = 40
118
- } = {}) {
119
- const svg = `
120
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
121
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
122
- <!-- Border pattern -->
123
- <rect x="0" y="0" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
124
- <rect x="0" y="${size * 0.9}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
125
- <rect x="0" y="0" width="${size * 0.1}" height="${size}" fill="${primaryColor}"/>
126
- <rect x="${size * 0.9}" y="0" width="${size * 0.1}" height="${size}" fill="${primaryColor}"/>
127
- <!-- Center motif -->
128
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.15}" fill="${secondaryColor}"/>
129
- <text x="${size * 0.5}" y="${size * 0.55}" text-anchor="middle" fill="${primaryColor}" font-size="${size * 0.08}">KANGA</text>
130
- </svg>
131
- `;
132
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
133
- }
134
-
135
- /**
136
- * Generate Kuba Border pattern (Congo)
137
- */
138
- export function generateKubaBorder({
139
- primaryColor = '#8B4513',
140
- secondaryColor = '#DAA520',
141
- backgroundColor = '#F5F5DC',
142
- size = 30
143
- } = {}) {
144
- const svg = `
145
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
146
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
147
- <!-- Kuba geometric border -->
148
- <polygon points="0,0 ${size * 0.3},0 0,${size * 0.3}" fill="${primaryColor}"/>
149
- <polygon points="${size},0 ${size * 0.7},0 ${size},${size * 0.3}" fill="${primaryColor}"/>
150
- <polygon points="0,${size} ${size * 0.3},${size} 0,${size * 0.7}" fill="${primaryColor}"/>
151
- <polygon points="${size},${size} ${size * 0.7},${size} ${size},${size * 0.7}" fill="${primaryColor}"/>
152
- <!-- Center diamond -->
153
- <polygon points="${size * 0.5},${size * 0.3} ${size * 0.7},${size * 0.5} ${size * 0.5},${size * 0.7} ${size * 0.3},${size * 0.5}" fill="${secondaryColor}"/>
154
- </svg>
155
- `;
156
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
157
- }
158
-
159
- /**
160
- * Generate Zulu Beads pattern (South Africa)
161
- */
162
- export function generateZuluBeads({
163
- primaryColor = '#FF0000',
164
- secondaryColor = '#000000',
165
- accentColor = '#FFFFFF',
166
- size = 40
167
- } = {}) {
168
- const svg = `
169
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
170
- <rect width="${size}" height="${size}" fill="${accentColor}"/>
171
- <!-- Bead pattern -->
172
- <circle cx="${size * 0.2}" cy="${size * 0.2}" r="${size * 0.08}" fill="${primaryColor}"/>
173
- <circle cx="${size * 0.5}" cy="${size * 0.2}" r="${size * 0.08}" fill="${secondaryColor}"/>
174
- <circle cx="${size * 0.8}" cy="${size * 0.2}" r="${size * 0.08}" fill="${primaryColor}"/>
175
- <circle cx="${size * 0.2}" cy="${size * 0.5}" r="${size * 0.08}" fill="${secondaryColor}"/>
176
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.08}" fill="${primaryColor}"/>
177
- <circle cx="${size * 0.8}" cy="${size * 0.5}" r="${size * 0.08}" fill="${secondaryColor}"/>
178
- <circle cx="${size * 0.2}" cy="${size * 0.8}" r="${size * 0.08}" fill="${primaryColor}"/>
179
- <circle cx="${size * 0.5}" cy="${size * 0.8}" r="${size * 0.08}" fill="${secondaryColor}"/>
180
- <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.08}" fill="${primaryColor}"/>
181
- </svg>
182
- `;
183
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
184
- }
185
-
186
- /**
187
- * Generate Maasai Shield pattern (Kenya/Tanzania)
188
- */
189
- export function generateMasaiShield({
190
- primaryColor = '#8B0000',
191
- secondaryColor = '#FFD700',
192
- backgroundColor = '#654321',
193
- size = 50
194
- } = {}) {
195
- const svg = `
196
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
197
- <ellipse cx="${size * 0.5}" cy="${size * 0.5}" rx="${size * 0.4}" ry="${size * 0.45}" fill="${backgroundColor}"/>
198
- <!-- Shield patterns -->
199
- <ellipse cx="${size * 0.5}" cy="${size * 0.3}" rx="${size * 0.2}" ry="${size * 0.15}" fill="${primaryColor}"/>
200
- <rect x="${size * 0.4}" y="${size * 0.5}" width="${size * 0.2}" height="${size * 0.3}" fill="${secondaryColor}"/>
201
- <!-- Decorative lines -->
202
- <line x1="${size * 0.3}" y1="${size * 0.2}" x2="${size * 0.7}" y2="${size * 0.2}" stroke="${primaryColor}" stroke-width="3"/>
203
- <line x1="${size * 0.3}" y1="${size * 0.8}" x2="${size * 0.7}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="3"/>
204
- </svg>
205
- `;
206
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
207
- }
208
-
209
- /**
210
- * Generate Ndebele Paint house pattern (South Africa)
211
- */
212
- export function generateNdebelePaint({
213
- primaryColor = '#FF1493',
214
- secondaryColor = '#00FF00',
215
- accentColor = '#FFFF00',
216
- backgroundColor = '#FFFFFF',
217
- size = 50
218
- } = {}) {
219
- const svg = `
220
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
221
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
222
- <!-- Ndebele geometric patterns -->
223
- <polygon points="${size * 0.2},${size * 0.2} ${size * 0.4},${size * 0.2} ${size * 0.3},${size * 0.4}" fill="${primaryColor}"/>
224
- <polygon points="${size * 0.6},${size * 0.2} ${size * 0.8},${size * 0.2} ${size * 0.7},${size * 0.4}" fill="${secondaryColor}"/>
225
- <polygon points="${size * 0.2},${size * 0.6} ${size * 0.4},${size * 0.6} ${size * 0.3},${size * 0.8}" fill="${accentColor}"/>
226
- <polygon points="${size * 0.6},${size * 0.6} ${size * 0.8},${size * 0.6} ${size * 0.7},${size * 0.8}" fill="${primaryColor}"/>
227
- <!-- Center design -->
228
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.15}" fill="${secondaryColor}"/>
229
- <rect x="${size * 0.45}" y="${size * 0.45}" width="${size * 0.1}" height="${size * 0.1}" fill="${accentColor}"/>
230
- </svg>
231
- `;
232
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
233
- }
234
-
235
- /**
236
- * Generate Kitenge floral pattern (East Africa)
237
- */
238
- export function generateKitenge({
239
- primaryColor = '#00A3DD',
240
- secondaryColor = '#FCD116',
241
- backgroundColor = '#1EB53A',
242
- size = 50
243
- } = {}) {
244
- const svg = `
245
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
246
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
247
- <circle cx="${size * 0.25}" cy="${size * 0.25}" r="${size * 0.2}" fill="${primaryColor}" opacity="0.8"/>
248
- <circle cx="${size * 0.75}" cy="${size * 0.75}" r="${size * 0.2}" fill="${primaryColor}" opacity="0.8"/>
249
- <circle cx="${size * 0.25}" cy="${size * 0.25}" r="${size * 0.1}" fill="${secondaryColor}"/>
250
- <circle cx="${size * 0.75}" cy="${size * 0.75}" r="${size * 0.1}" fill="${secondaryColor}"/>
251
- <circle cx="${size * 0.75}" cy="${size * 0.25}" r="${size * 0.08}" fill="${secondaryColor}" opacity="0.6"/>
252
- <circle cx="${size * 0.25}" cy="${size * 0.75}" r="${size * 0.08}" fill="${secondaryColor}" opacity="0.6"/>
253
- </svg>
254
- `;
255
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
256
- }
257
-
258
- // ============================================
259
- // WEST AFRICAN PATTERNS
260
- // ============================================
261
-
262
- /**
263
- * Generate Ghana Kente cloth pattern
264
- * Royal cloth of the Ashanti people with geometric strips
265
- * Colors: Gold (royalty), Green (harvest), Red (blood/sacrifice)
266
- */
267
- export function generateKente({
268
- colors = ['#FFD700', '#228B22', '#DC143C', '#000000'],
269
- size = 60
270
- } = {}) {
271
- const [gold, green, red, black] = colors;
272
- const stripe = size / 6;
273
-
274
- const svg = `
275
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
276
- <rect width="${size}" height="${size}" fill="${black}"/>
277
- <!-- Horizontal bands -->
278
- <rect x="0" y="0" width="${size}" height="${stripe}" fill="${gold}"/>
279
- <rect x="0" y="${stripe}" width="${size}" height="${stripe}" fill="${green}"/>
280
- <rect x="0" y="${stripe * 2}" width="${size}" height="${stripe}" fill="${red}"/>
281
- <rect x="0" y="${stripe * 3}" width="${size}" height="${stripe}" fill="${gold}"/>
282
- <rect x="0" y="${stripe * 4}" width="${size}" height="${stripe}" fill="${green}"/>
283
- <rect x="0" y="${stripe * 5}" width="${size}" height="${stripe}" fill="${red}"/>
284
- <!-- Vertical accents -->
285
- <rect x="${size * 0.2}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
286
- <rect x="${size * 0.4}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
287
- <rect x="${size * 0.6}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
288
- <rect x="${size * 0.8}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
289
- <!-- Kente squares -->
290
- <rect x="${size * 0.1}" y="${size * 0.1}" width="${size * 0.15}" height="${size * 0.15}" fill="${gold}" stroke="${black}" stroke-width="1"/>
291
- <rect x="${size * 0.75}" y="${size * 0.75}" width="${size * 0.15}" height="${size * 0.15}" fill="${red}" stroke="${black}" stroke-width="1"/>
292
- </svg>
293
- `;
294
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
295
- }
296
-
297
- /**
298
- * Generate Ghana Adinkra symbols pattern
299
- * Philosophical symbols of the Akan people
300
- * Each symbol represents concepts like wisdom, strength, unity
301
- */
302
- export function generateAdinkra({
303
- symbolColor = '#000000',
304
- backgroundColor = '#CD853F',
305
- size = 50
306
- } = {}) {
307
- // Gye Nyame symbol (Supremacy of God) simplified
308
- const svg = `
309
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
310
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
311
- <!-- Sankofa-inspired heart shape (go back and get it) -->
312
- <path d="M${size * 0.5} ${size * 0.2}
313
- C${size * 0.3} ${size * 0.1} ${size * 0.15} ${size * 0.3} ${size * 0.25} ${size * 0.5}
314
- L${size * 0.5} ${size * 0.8}
315
- L${size * 0.75} ${size * 0.5}
316
- C${size * 0.85} ${size * 0.3} ${size * 0.7} ${size * 0.1} ${size * 0.5} ${size * 0.2}"
317
- fill="none" stroke="${symbolColor}" stroke-width="3"/>
318
- <!-- Spiral detail -->
319
- <circle cx="${size * 0.35}" cy="${size * 0.45}" r="${size * 0.08}" fill="none" stroke="${symbolColor}" stroke-width="2"/>
320
- <circle cx="${size * 0.65}" cy="${size * 0.45}" r="${size * 0.08}" fill="none" stroke="${symbolColor}" stroke-width="2"/>
321
- </svg>
322
- `;
323
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
324
- }
325
-
326
- /**
327
- * Generate Nigeria Aso-Oke pattern (Yoruba)
328
- * Hand-woven cloth with intricate strip patterns
329
- * Traditional for special occasions
330
- */
331
- export function generateAsoOke({
332
- colors = ['#4B0082', '#FFD700', '#FFFFFF'],
333
- size = 50
334
- } = {}) {
335
- const [indigo, gold, white] = colors;
336
- const stripe = size / 10;
337
-
338
- const svg = `
339
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
340
- <rect width="${size}" height="${size}" fill="${indigo}"/>
341
- <!-- Horizontal stripes -->
342
- <rect x="0" y="${stripe}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
343
- <rect x="0" y="${stripe * 3}" width="${size}" height="${stripe * 0.5}" fill="${white}"/>
344
- <rect x="0" y="${stripe * 5}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
345
- <rect x="0" y="${stripe * 7}" width="${size}" height="${stripe * 0.5}" fill="${white}"/>
346
- <rect x="0" y="${stripe * 9}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
347
- <!-- Vertical accent lines -->
348
- <rect x="${size * 0.48}" y="0" width="${stripe * 0.4}" height="${size}" fill="${gold}" opacity="0.7"/>
349
- <!-- Diamond motifs -->
350
- <polygon points="${size * 0.25},${size * 0.3} ${size * 0.35},${size * 0.5} ${size * 0.25},${size * 0.7} ${size * 0.15},${size * 0.5}"
351
- fill="${gold}" stroke="${white}" stroke-width="1"/>
352
- <polygon points="${size * 0.75},${size * 0.3} ${size * 0.85},${size * 0.5} ${size * 0.75},${size * 0.7} ${size * 0.65},${size * 0.5}"
353
- fill="${gold}" stroke="${white}" stroke-width="1"/>
354
- </svg>
355
- `;
356
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
357
- }
358
-
359
- /**
360
- * Generate Nigeria Ankara/African wax print pattern
361
- * Bold, colorful designs popular across Africa
362
- */
363
- export function generateAnkara({
364
- primaryColor = '#FF6B00',
365
- secondaryColor = '#00A86B',
366
- accentColor = '#FFD700',
367
- backgroundColor = '#FFFFFF',
368
- size = 60
369
- } = {}) {
370
- const svg = `
371
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
372
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
373
- <!-- Bold circular motifs -->
374
- <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.25}" fill="${primaryColor}"/>
375
- <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.15}" fill="${secondaryColor}"/>
376
- <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.08}" fill="${accentColor}"/>
377
-
378
- <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.2}" fill="${secondaryColor}"/>
379
- <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.1}" fill="${primaryColor}"/>
380
-
381
- <!-- Connecting lines -->
382
- <line x1="${size * 0.45}" y1="${size * 0.45}" x2="${size * 0.65}" y2="${size * 0.65}"
383
- stroke="${primaryColor}" stroke-width="4"/>
384
-
385
- <!-- Small dots -->
386
- <circle cx="${size * 0.1}" cy="${size * 0.8}" r="${size * 0.05}" fill="${accentColor}"/>
387
- <circle cx="${size * 0.9}" cy="${size * 0.2}" r="${size * 0.05}" fill="${accentColor}"/>
388
- </svg>
389
- `;
390
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
391
- }
392
-
393
- // ============================================
394
- // CENTRAL & NORTH AFRICAN PATTERNS
395
- // ============================================
396
-
397
- /**
398
- * Generate Bogolanfini (Mud Cloth) pattern (Mali)
399
- * Geometric abstract designs in earth tones
400
- */
401
- export function generateBogolan({
402
- primaryColor = '#000000',
403
- secondaryColor = '#FFFFFF',
404
- accentColor = '#8B4513',
405
- size = 60
406
- } = {}) {
407
- const svg = `
408
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
409
- <rect width="${size}" height="${size}" fill="${primaryColor}"/>
410
- <!-- Zigzags -->
411
- <polyline points="0,${size * 0.2} ${size * 0.25},0 ${size * 0.5},${size * 0.2} ${size * 0.75},0 ${size},${size * 0.2}"
412
- fill="none" stroke="${secondaryColor}" stroke-width="3"/>
413
- <polyline points="0,${size * 0.8} ${size * 0.25},${size} ${size * 0.5},${size * 0.8} ${size * 0.75},${size} ${size},${size * 0.8}"
414
- fill="none" stroke="${secondaryColor}" stroke-width="3"/>
415
- <!-- Crosses -->
416
- <line x1="${size * 0.25}" y1="${size * 0.4}" x2="${size * 0.25}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
417
- <line x1="${size * 0.15}" y1="${size * 0.5}" x2="${size * 0.35}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
418
- <line x1="${size * 0.75}" y1="${size * 0.4}" x2="${size * 0.75}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
419
- <line x1="${size * 0.65}" y1="${size * 0.5}" x2="${size * 0.85}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
420
- <!-- Dots -->
421
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.08}" fill="${accentColor}"/>
422
- </svg>
423
- `;
424
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
425
- }
426
-
427
- /**
428
- * Generate Kuba Shoowa pattern (DRC)
429
- * Complex interlocking geometric shapes
430
- */
431
- export function generateKuba({
432
- primaryColor = '#D2B48C',
433
- secondaryColor = '#3E2723',
434
- size = 60
435
- } = {}) {
436
- const svg = `
437
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
438
- <rect width="${size}" height="${size}" fill="${primaryColor}"/>
439
- <!-- Interlocking diamonds/rectangles -->
440
- <rect x="${size * 0.1}" y="${size * 0.1}" width="${size * 0.3}" height="${size * 0.3}" fill="${secondaryColor}"/>
441
- <rect x="${size * 0.6}" y="${size * 0.6}" width="${size * 0.3}" height="${size * 0.3}" fill="${secondaryColor}"/>
442
- <rect x="${size * 0.6}" y="${size * 0.1}" width="${size * 0.3}" height="${size * 0.3}"
443
- fill="none" stroke="${secondaryColor}" stroke-width="4"/>
444
- <rect x="${size * 0.1}" y="${size * 0.6}" width="${size * 0.3}" height="${size * 0.3}"
445
- fill="none" stroke="${secondaryColor}" stroke-width="4"/>
446
- <!-- Center lines -->
447
- <line x1="${size * 0.4}" y1="${size * 0.5}" x2="${size * 0.6}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
448
- <line x1="${size * 0.5}" y1="${size * 0.4}" x2="${size * 0.5}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
449
- </svg>
450
- `;
451
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
452
- }
453
-
454
- /**
455
- * Generate Imigongo pattern (Rwanda)
456
- * Spiral/Geometric ridges traditionally made from cow dung
457
- */
458
- export function generateImigongo({
459
- primaryColor = '#000000',
460
- secondaryColor = '#FFFFFF',
461
- accentColor = '#B22222',
462
- size = 60
463
- } = {}) {
464
- const svg = `
465
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
466
- <rect width="${size}" height="${size}" fill="${secondaryColor}"/>
467
- <!-- Spiral/Diamond Motif -->
468
- <path d="M${size * 0.5} ${size * 0.1}
469
- L${size * 0.9} ${size * 0.5}
470
- L${size * 0.5} ${size * 0.9}
471
- L${size * 0.1} ${size * 0.5} Z"
472
- fill="${primaryColor}"/>
473
- <path d="M${size * 0.5} ${size * 0.3}
474
- L${size * 0.7} ${size * 0.5}
475
- L${size * 0.5} ${size * 0.7}
476
- L${size * 0.3} ${size * 0.5} Z"
477
- fill="${secondaryColor}"/>
478
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${accentColor}"/>
479
- </svg>
480
- `;
481
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
482
- }
483
-
484
- /**
485
- * Generate Ethiopian Tibeb pattern
486
- * Vibrant woven geometric borders
487
- */
488
- export function generateTibeb({
489
- colors = ['#009E60', '#FCDD09', '#EF3340'], // Ethiopian flag colors
490
- backgroundColor = '#FFFFFF',
491
- size = 40
492
- } = {}) {
493
- const [c1, c2, c3] = colors;
494
- const svg = `
495
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
496
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
497
- <!-- Diamond Chain -->
498
- <polygon points="${size * 0.5},0 ${size},${size * 0.5} ${size * 0.5},${size} 0,${size * 0.5}"
499
- fill="${c1}" opacity="0.2"/>
500
- <polygon points="${size * 0.5},${size * 0.2} ${size * 0.8},${size * 0.5} ${size * 0.5},${size * 0.8} ${size * 0.2},${size * 0.5}"
501
- fill="${c2}"/>
502
- <rect x="${size * 0.4}" y="${size * 0.4}" width="${size * 0.2}" height="${size * 0.2}" fill="${c3}"/>
503
- <!-- Side accents -->
504
- <line x1="0" y1="0" x2="0" y2="${size}" stroke="${c1}" stroke-width="4"/>
505
- <line x1="${size}" y1="0" x2="${size}" y2="${size}" stroke="${c1}" stroke-width="4"/>
506
- </svg>
507
- `;
508
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
509
- }
510
-
511
- // ============================================
512
- // SOUTHERN AFRICAN PATTERNS
513
- // ============================================
514
-
515
- /**
516
- * Generate Ndebele geometric mural pattern (South Africa)
517
- */
518
- export function generateNdebele({
519
- colors = ['#FFD700', '#4169E1', '#FF69B4', '#228B22'],
520
- size = 60,
521
- strokeWidth = 2
522
- } = {}) {
523
- const [c1, c2, c3, c4] = colors;
524
- const svg = `
525
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
526
- <rect width="${size}" height="${size}" fill="#FFFFFF"/>
527
- <rect x="${strokeWidth}" y="${strokeWidth}"
528
- width="${size - strokeWidth * 2}" height="${size - strokeWidth * 2}"
529
- fill="none" stroke="#000000" stroke-width="${strokeWidth}"/>
530
- <rect x="${size * 0.15}" y="${size * 0.15}" width="${size * 0.35}" height="${size * 0.35}"
531
- fill="${c1}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
532
- <rect x="${size * 0.5}" y="${size * 0.15}" width="${size * 0.35}" height="${size * 0.35}"
533
- fill="${c2}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
534
- <rect x="${size * 0.15}" y="${size * 0.5}" width="${size * 0.35}" height="${size * 0.35}"
535
- fill="${c3}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
536
- <rect x="${size * 0.5}" y="${size * 0.5}" width="${size * 0.35}" height="${size * 0.35}"
537
- fill="${c4}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
538
- <polygon points="${size / 2},${size * 0.3} ${size * 0.7},${size / 2} ${size / 2},${size * 0.7} ${size * 0.3},${size / 2}"
539
- fill="#FFFFFF" stroke="#000000" stroke-width="${strokeWidth}"/>
540
- </svg>
541
- `;
542
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
543
- }
544
-
545
- /**
546
- * Generate Zulu beadwork pattern (South Africa)
547
- * Traditional "love letter" beadwork with symbolic colors
548
- * Colors carry deep meaning in Zulu courtship
549
- */
550
- export function generateZulu({
551
- colors = ['#FFFFFF', '#000000', '#FF0000', '#00A86B', '#FFD700'],
552
- size = 50
553
- } = {}) {
554
- const [white, black, red, green, gold] = colors;
555
- const bead = size / 10;
556
-
557
- const svg = `
558
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
559
- <rect width="${size}" height="${size}" fill="${black}"/>
560
- <!-- Triangle pattern (isivivane - sacred cairn) -->
561
- <polygon points="${size * 0.5},${size * 0.1} ${size * 0.9},${size * 0.9} ${size * 0.1},${size * 0.9}"
562
- fill="none" stroke="${white}" stroke-width="2"/>
563
- <polygon points="${size * 0.5},${size * 0.25} ${size * 0.75},${size * 0.75} ${size * 0.25},${size * 0.75}"
564
- fill="${red}"/>
565
- <!-- Beadwork dots -->
566
- <circle cx="${size * 0.5}" cy="${size * 0.35}" r="${bead}" fill="${white}"/>
567
- <circle cx="${size * 0.35}" cy="${size * 0.6}" r="${bead}" fill="${green}"/>
568
- <circle cx="${size * 0.65}" cy="${size * 0.6}" r="${bead}" fill="${gold}"/>
569
- <circle cx="${size * 0.5}" cy="${size * 0.8}" r="${bead}" fill="${white}"/>
570
- <!-- Border dots -->
571
- <circle cx="${size * 0.1}" cy="${size * 0.1}" r="${bead * 0.7}" fill="${red}"/>
572
- <circle cx="${size * 0.9}" cy="${size * 0.1}" r="${bead * 0.7}" fill="${green}"/>
573
- </svg>
574
- `;
575
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
576
- }
577
-
578
- /**
579
- * Generate Swazi/Eswatini pattern
580
- */
581
- export function generateSwazi({
582
- primaryColor = '#003082', // Blue
583
- secondaryColor = '#FCD116', // Yellow
584
- accentColor = '#C8102E', // Red
585
- backgroundColor = '#FFFFFF',
586
- size = 50
587
- } = {}) {
588
- const svg = `
589
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
590
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
591
- <!-- Swazi shield-like pattern -->
592
- <path d="M${size * 0.5},0 C${size * 0.8},${size * 0.1} ${size},${size * 0.3} ${size},${size * 0.5} C${size},${size * 0.7} ${size * 0.8},${size * 0.9} ${size * 0.5},${size} C${size * 0.2},${size * 0.9} 0,${size * 0.7} 0,${size * 0.5} C0,${size * 0.3} ${size * 0.2},${size * 0.1} ${size * 0.5},0 Z" fill="${primaryColor}" opacity="0.8"/>
593
- <!-- Diagonal stripes -->
594
- <line x1="0" y1="${size * 0.2}" x2="${size * 0.2}" y2="0" stroke="${secondaryColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
595
- <line x1="0" y1="${size * 0.4}" x2="${size * 0.4}" y2="0" stroke="${accentColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
596
- <line x1="0" y1="${size * 0.6}" x2="${size * 0.6}" y2="0" stroke="${secondaryColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
597
- <line x1="0" y1="${size * 0.8}" x2="${size * 0.8}" y2="0" stroke="${accentColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
598
- <line x1="${size * 0.2}" y1="${size}" x2="${size}" y2="${size * 0.2}" stroke="${secondaryColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
599
- <line x1="${size * 0.4}" y1="${size}" x2="${size}" y2="${size * 0.4}" stroke="${accentColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
600
- <line x1="${size * 0.6}" y1="${size}" x2="${size}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
601
- <line x1="${size * 0.8}" y1="${size}" x2="${size}" y2="${size * 0.8}" stroke="${accentColor}" stroke-width="${size * 0.1}" stroke-opacity="0.7"/>
602
- </svg>
603
- `;
604
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
605
- }
606
-
607
- /**
608
- * Generate Xhosa pattern
609
- */
610
- export function generateXhosa({
611
- primaryColor = '#000000', // Black
612
- secondaryColor = '#FFFFFF', // White
613
- accentColor = '#FF0000', // Red
614
- size = 50
615
- } = {}) {
616
- const svg = `
617
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
618
- <rect width="${size}" height="${size}" fill="${secondaryColor}"/>
619
- <!-- Xhosa geometric triangles -->
620
- <polygon points="0,0 ${size * 0.5},${size * 0.5} 0,${size}" fill="${primaryColor}"/>
621
- <polygon points="${size},0 ${size * 0.5},${size * 0.5} ${size},${size}" fill="${primaryColor}"/>
622
- <!-- Center diamond -->
623
- <polygon points="${size * 0.4},${size * 0.3} ${size * 0.5},${size * 0.2} ${size * 0.6},${size * 0.3} ${size * 0.5},${size * 0.4}" fill="${accentColor}"/>
624
- <polygon points="${size * 0.4},${size * 0.7} ${size * 0.5},${size * 0.8} ${size * 0.6},${size * 0.7} ${size * 0.5},${size * 0.6}" fill="${accentColor}"/>
625
- <!-- Horizontal band -->
626
- <rect x="0" y="${size * 0.45}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
627
- </svg>
628
- `;
629
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
630
- }
631
-
632
- /**
633
- * Generate Swazi/Eswatini pattern
634
- * Inspired by Ligwalagwala (purple-crested turaco) and royal patterns
635
- * Traditional shields and ceremonial designs
636
- */
637
- export function generateSwazi({
638
- colors = ['#3E5EB9', '#FECD00', '#B10C0C', '#FFFFFF'],
639
- size = 50
640
- } = {}) {
641
- const [blue, gold, red, white] = colors;
642
-
643
- const svg = `
644
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
645
- <rect width="${size}" height="${size}" fill="${blue}"/>
646
- <!-- Shield shape (central to Eswatini culture) -->
647
- <ellipse cx="${size * 0.5}" cy="${size * 0.45}" rx="${size * 0.35}" ry="${size * 0.4}"
648
- fill="${gold}" stroke="${red}" stroke-width="3"/>
649
- <!-- Inner pattern -->
650
- <ellipse cx="${size * 0.5}" cy="${size * 0.45}" rx="${size * 0.2}" ry="${size * 0.25}"
651
- fill="${red}"/>
652
- <!-- Feather accents -->
653
- <line x1="${size * 0.5}" y1="${size * 0.05}" x2="${size * 0.5}" y2="${size * 0.2}"
654
- stroke="${white}" stroke-width="3"/>
655
- <line x1="${size * 0.4}" y1="${size * 0.08}" x2="${size * 0.45}" y2="${size * 0.15}"
656
- stroke="${white}" stroke-width="2"/>
657
- <line x1="${size * 0.6}" y1="${size * 0.08}" x2="${size * 0.55}" y2="${size * 0.15}"
658
- stroke="${white}" stroke-width="2"/>
659
- <!-- Spear points -->
660
- <polygon points="${size * 0.1},${size * 0.3} ${size * 0.05},${size * 0.5} ${size * 0.15},${size * 0.5}" fill="${white}"/>
661
- <polygon points="${size * 0.9},${size * 0.3} ${size * 0.85},${size * 0.5} ${size * 0.95},${size * 0.5}" fill="${white}"/>
662
- </svg>
663
- `;
664
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
665
- }
666
-
667
- /**
668
- * Generate Xhosa pattern (South Africa)
669
- * Inspired by traditional Xhosa beadwork and blanket designs
670
- * Known for bold geometric patterns
671
- */
672
- export function generateXhosa({
673
- primaryColor = '#FFFFFF',
674
- accentColor = '#00A86B',
675
- backgroundColor = '#1a1a2e',
676
- size = 50
677
- } = {}) {
678
- const svg = `
679
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
680
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
681
- <!-- Horizontal bands -->
682
- <rect x="0" y="${size * 0.2}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
683
- <rect x="0" y="${size * 0.7}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
684
- <!-- Vertical bands -->
685
- <rect x="${size * 0.2}" y="0" width="${size * 0.1}" height="${size}" fill="${accentColor}"/>
686
- <rect x="${size * 0.7}" y="0" width="${size * 0.1}" height="${size}" fill="${accentColor}"/>
687
- <!-- Central diamond -->
688
- <polygon points="${size * 0.5},${size * 0.35} ${size * 0.65},${size * 0.5} ${size * 0.5},${size * 0.65} ${size * 0.35},${size * 0.5}"
689
- fill="${accentColor}" stroke="${primaryColor}" stroke-width="2"/>
690
- <!-- Corner triangles -->
691
- <polygon points="0,0 ${size * 0.15},0 0,${size * 0.15}" fill="${accentColor}"/>
692
- <polygon points="${size},0 ${size * 0.85},0 ${size},${size * 0.15}" fill="${accentColor}"/>
693
- <polygon points="0,${size} ${size * 0.15},${size} 0,${size * 0.85}" fill="${accentColor}"/>
694
- <polygon points="${size},${size} ${size * 0.85},${size} ${size},${size * 0.85}" fill="${accentColor}"/>
695
- </svg>
696
- `;
697
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
698
- }
699
-
700
- /**
701
- * Apply pattern as background to an element
702
- */
703
- export function applyPattern(element, patternUrl) {
704
- element.style.backgroundImage = `url("${patternUrl}")`;
705
- element.style.backgroundRepeat = 'repeat';
706
- }
707
-
708
- // ============================================
709
- // NORTH AFRICAN PATTERNS
710
- // ============================================
711
-
712
- /**
713
- * Generate Berber pattern (North Africa)
714
- * Geometric designs inspired by Amazigh rugs and tattoos
715
- * Symbols of protection, fertility, and nature
716
- */
717
- export function generateBerber({
718
- primaryColor = '#8B0000', // Deep red
719
- secondaryColor = '#000000',
720
- accentColor = '#FFD700',
721
- backgroundColor = '#F5F5DC', // Beige/Wool
722
- size = 60
723
- } = {}) {
724
- const svg = `
725
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
726
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
727
- <!-- Lozenge (Diamond) - universal protective symbol -->
728
- <polygon points="${size * 0.5},${size * 0.1} ${size * 0.9},${size * 0.5} ${size * 0.5},${size * 0.9} ${size * 0.1},${size * 0.5}"
729
- fill="${primaryColor}" stroke="${secondaryColor}" stroke-width="2"/>
730
- <!-- Inner geometric details -->
731
- <line x1="${size * 0.5}" y1="${size * 0.1}" x2="${size * 0.5}" y2="${size * 0.9}" stroke="${accentColor}" stroke-width="2"/>
732
- <line x1="${size * 0.1}" y1="${size * 0.5}" x2="${size * 0.9}" y2="${size * 0.5}" stroke="${accentColor}" stroke-width="2"/>
733
- <!-- X symbols (Fibula/Cross) -->
734
- <line x1="${size * 0.4}" y1="${size * 0.4}" x2="${size * 0.6}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
735
- <line x1="${size * 0.6}" y1="${size * 0.4}" x2="${size * 0.4}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
736
- </svg>
737
- `;
738
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
739
- }
740
-
741
- /**
742
- * Generate Adire Oniko (Yoruba Indigo) pattern
743
- * Resist-dyed circles and ripples
744
- * "Tie and dye" technique simulation
745
- */
746
- export function generateAdire({
747
- primaryColor = '#4B0082', // Indigo
748
- secondaryColor = '#8A2BE2', // Light Indigo
749
- accentColor = '#FFFFFF',
750
- size = 50
751
- } = {}) {
752
- const svg = `
753
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
754
- <rect width="${size}" height="${size}" fill="${primaryColor}"/>
755
- <!-- Resist circles (Oniko) -->
756
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.35}" fill="none" stroke="${secondaryColor}" stroke-width="3"/>
757
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.25}" fill="none" stroke="${accentColor}" stroke-width="2" stroke-dasharray="4 2"/>
758
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${accentColor}" opacity="0.8"/>
759
- <!-- Corner ripples -->
760
- <path d="M0,0 Q${size * 0.2},0 ${size * 0.2},${size * 0.2} Q0,${size * 0.2} 0,0" fill="${secondaryColor}"/>
761
- <path d="M${size},${size} Q${size * 0.8},${size} ${size * 0.8},${size * 0.8} Q${size},${size * 0.8} ${size},${size}" fill="${secondaryColor}"/>
762
- </svg>
763
- `;
764
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
765
- }
766
-
767
- // Export all generators
768
- export default {
769
- // East Africa
770
- generatePolygon,
771
- generateShuka,
772
- generateHadzabe,
773
- generateKanga,
774
- generateKangaBorder,
775
- generateKitenge,
776
- generateMasaiShield,
777
- generateTibeb, // Ethiopia
778
- generateImigongo, // Rwanda
779
- // West Africa
780
- generateKente,
781
- generateAdinkra,
782
- generateAsoOke,
783
- generateAnkara,
784
- generateBogolan, // Mali/West
785
- generateAdire, // Nigeria (Indigo)
786
- // Central Africa
787
- generateKuba, // DRC
788
- generateKubaBorder,
789
- // North Africa
790
- generateBerber, // Amazigh
791
- // Southern Africa
792
- generateNdebele,
793
- generateNdebelePaint,
794
- generateZulu,
795
- generateZuluBeads,
796
- generateSwazi,
797
- generateXhosa,
798
- generateYorubaAdire,
799
- generateAkanKente,
800
- // Utilities
801
- applyPattern,
802
- // Tech Patterns
803
- generateTuareg,
804
- generateGeez,
805
- generateBoli,
806
- generateCircuit,
807
- circuit: generateCircuit
808
- };
809
-
810
- /**
811
- * Generate Tuareg Indigo pattern (Sahara/Berber)
812
- * Inspired by the "Blue Men of the Sahara" and their geometric silver jewelry/stars
813
- */
814
- export function generateTuareg({
815
- primaryColor = '#2D3D6B', // Tuareg Indigo
816
- secondaryColor = '#6B8CC7', // Sky Blue
817
- accentColor = '#FFFFFF', // Silver/White
818
- size = 60
819
- } = {}) {
820
- const svg = `
821
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
822
- <rect width="${size}" height="${size}" fill="${primaryColor}"/>
823
- <!-- Southern Cross / Tuareg Star -->
824
- <path d="M${size * 0.5} 0 L${size * 0.6} ${size * 0.4} L${size} ${size * 0.5} L${size * 0.6} ${size * 0.6} L${size * 0.5} ${size} L${size * 0.4} ${size * 0.6} L0 ${size * 0.5} L${size * 0.4} ${size * 0.4} Z"
825
- fill="none" stroke="${accentColor}" stroke-width="2"/>
826
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${secondaryColor}"/>
827
- </svg>
828
- `;
829
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
830
- }
831
-
832
- /**
833
- * Generate Ge'ez Script pattern (Ethiopia/Eritrea)
834
- * Abstract calligraphic strokes inspired by one of the world's oldest scripts
835
- */
836
- export function generateGeez({
837
- inkColor = '#3A2E2C',
838
- parchmentColor = '#F4E4BC',
839
- size = 50
840
- } = {}) {
841
- const svg = `
842
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
843
- <rect width="${size}" height="${size}" fill="${parchmentColor}"/>
844
- <path d="M${size * 0.2} ${size * 0.2} L${size * 0.4} ${size * 0.2} M${size * 0.3} ${size * 0.2} L${size * 0.3} ${size * 0.5} Q${size * 0.4} ${size * 0.6} ${size * 0.2} ${size * 0.7}"
845
- fill="none" stroke="${inkColor}" stroke-width="3" stroke-linecap="round"/>
846
- <path d="M${size * 0.6} ${size * 0.3} C${size * 0.8} ${size * 0.3} ${size * 0.8} ${size * 0.6} ${size * 0.6} ${size * 0.6} L${size * 0.8} ${size * 0.8}"
847
- fill="none" stroke="${inkColor}" stroke-width="3" stroke-linecap="round"/>
848
- </svg>
849
- `;
850
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
851
- }
852
-
853
- /**
854
- * Generate Boli pattern (Mali/Bambara)
855
- * Abstract organic shapes inspired by mud-based ritual objects
856
- */
857
- export function generateBoli({
858
- clayColor = '#4E342E',
859
- earthColor = '#3E2723',
860
- accentColor = '#BCAAA4',
861
- size = 60
862
- } = {}) {
863
- const svg = `
864
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
865
- <rect width="${size}" height="${size}" fill="${earthColor}"/>
866
- <path d="M${size * 0.2} ${size * 0.5} Q${size * 0.3} ${size * 0.2} ${size * 0.5} ${size * 0.3} T${size * 0.8} ${size * 0.5} Q${size * 0.7} ${size * 0.8} ${size * 0.5} ${size * 0.7} T${size * 0.2} ${size * 0.5}"
867
- fill="${clayColor}" stroke="${accentColor}" stroke-width="2"/>
868
- </svg>
869
- `;
870
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
871
- }
872
-
873
- export function generateCircuit({
874
- primaryColor = '#334155',
875
- secondaryColor = '#1e293b',
876
- size = 100
877
- } = {}) {
878
- const svg = `
879
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 100 100">
880
- <rect width="100" height="100" fill="${secondaryColor}"/>
881
- <path d="M10 10 H90 V90 H10 Z" fill="none" stroke="${primaryColor}" stroke-width="0.5" opacity="0.3"/>
882
- <path d="M20 20 V50 H50 V80 H80" fill="none" stroke="${primaryColor}" stroke-width="1"/>
883
- <circle cx="20" cy="20" r="2" fill="${primaryColor}"/>
884
- <circle cx="80" cy="80" r="2" fill="${primaryColor}"/>
885
- <circle cx="50" cy="50" r="1.5" fill="${primaryColor}"/>
886
- </svg>
887
- `;
888
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
889
- }
890
-
891
- /**
892
- * Generate Yoruba Adire pattern (Nigeria)
893
-
894
- * Traditional resist-dyed cloth patterns
895
-
896
- */
897
-
898
- export function generateYorubaAdire({
899
-
900
- primaryColor = '#000000',
901
-
902
- secondaryColor = '#FCD116',
903
-
904
- backgroundColor = '#FFFFFF',
905
-
906
- size = 50
907
-
908
- } = {}) {
909
-
910
- const svg = `
911
-
912
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
913
-
914
- <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
915
-
916
- <!-- Adire tie-dye circles -->
917
-
918
- <circle cx="${size * 0.2}" cy="${size * 0.2}" r="${size * 0.15}" fill="${primaryColor}"/>
919
-
920
- <circle cx="${size * 0.8}" cy="${size * 0.2}" r="${size * 0.15}" fill="${primaryColor}"/>
921
-
922
- <circle cx="${size * 0.2}" cy="${size * 0.8}" r="${size * 0.15}" fill="${primaryColor}"/>
923
-
924
- <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.15}" fill="${primaryColor}"/>
925
-
926
- <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${secondaryColor}"/>
927
-
928
- <!-- Connecting lines -->
929
-
930
- <line x1="${size * 0.2}" y1="${size * 0.2}" x2="${size * 0.8}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="2"/>
931
-
932
- <line x1="${size * 0.8}" y1="${size * 0.2}" x2="${size * 0.2}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="2"/>
933
-
934
- </svg>
935
-
936
- `;
937
-
938
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
939
-
940
- }
941
-
942
- /**
943
-
944
- * Generate Akan Kente pattern variation (Ghana)
945
-
946
- * Geometric patterns with cultural significance
947
-
948
- */
949
-
950
- export function generateAkanKente({
951
-
952
- colors = ['#000000', '#FCD116', '#E82127', '#006B3F'],
953
-
954
- size = 60
955
-
956
- } = {}) {
957
-
958
- const [black, gold, red, green] = colors;
959
-
960
- const stripe = size / 6;
961
-
962
- const svg = `
963
-
964
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
965
-
966
- <rect width="${size}" height="${size}" fill="${gold}"/>
967
-
968
- <!-- Horizontal black stripes -->
969
-
970
- <rect x="0" y="0" width="${size}" height="${stripe}" fill="${black}"/>
971
-
972
- <rect x="0" y="${stripe * 2}" width="${size}" height="${stripe}" fill="${black}"/>
973
-
974
- <rect x="0" y="${stripe * 4}" width="${size}" height="${stripe}" fill="${black}"/>
975
-
976
- <!-- Vertical red stripes -->
977
-
978
- <rect x="0" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
979
-
980
- <rect x="${stripe * 2}" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
981
-
982
- <rect x="${stripe * 4}" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
983
-
984
- <!-- Green corner squares -->
985
-
986
- <rect x="0" y="0" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
987
-
988
- <rect x="${size - stripe * 0.8}" y="0" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
989
-
990
- <rect x="0" y="${size - stripe * 0.8}" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
991
-
992
- <rect x="${size - stripe * 0.8}" y="${size - stripe * 0.8}" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
993
-
994
- </svg>
995
-
996
- `;
997
-
998
- return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
999
-
1000
- }
1001
-
1
+ /**
2
+ * AfriCode Procedural SVG Pattern Engine
3
+ *
4
+ * Generates lightweight, on-the-fly SVG patterns inspired by
5
+ * African textiles from across the continent:
6
+ *
7
+ * EAST AFRICA: Maasai Shuka, Kanga, Kitenge, Hadzabe
8
+ * WEST AFRICA: Ghana Kente, Adinkra, Nigeria Aso-Oke, Ankara
9
+ * SOUTHERN AFRICA: Ndebele, Zulu, Swazi/Eswatini, Xhosa
10
+ *
11
+ * @module core/patterns
12
+ */
13
+
14
+ /**
15
+ * Generate a polygon with n sides
16
+ * Based on the mathematical formula:
17
+ * x_i = cx + r * cos(2πi/n)
18
+ * y_i = cy + r * sin(2πi/n)
19
+ */
20
+ export function generatePolygon(n, r, cx = 50, cy = 50) {
21
+ const points = [];
22
+ for (let i = 0; i < n; i++) {
23
+ const angle = (2 * Math.PI * i) / n - Math.PI / 2;
24
+ const x = cx + r * Math.cos(angle);
25
+ const y = cy + r * Math.sin(angle);
26
+ points.push(`${x.toFixed(2)},${y.toFixed(2)}`);
27
+ }
28
+ return points.join(' ');
29
+ }
30
+
31
+ // ============================================
32
+ // EAST AFRICAN PATTERNS
33
+ // ============================================
34
+
35
+ /**
36
+ * Generate Maasai Shuka tartan pattern (Tanzania/Kenya)
37
+ * Traditional red checkered blanket with overlapping stripes
38
+ */
39
+ export function generateShuka({
40
+ primaryColor = '#FF0000',
41
+ secondaryColor = '#000000',
42
+ backgroundColor = '#8B0000',
43
+ stripeWidth = 4,
44
+ size = 40
45
+ } = {}) {
46
+ const svg = `
47
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
48
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
49
+ <rect x="0" y="0" width="${size}" height="${stripeWidth}" fill="${primaryColor}" opacity="0.8"/>
50
+ <rect x="0" y="${size / 2 - stripeWidth / 2}" width="${size}" height="${stripeWidth}" fill="${secondaryColor}" opacity="0.6"/>
51
+ <rect x="0" y="${size - stripeWidth}" width="${size}" height="${stripeWidth}" fill="${primaryColor}" opacity="0.8"/>
52
+ <rect x="0" y="0" width="${stripeWidth}" height="${size}" fill="${primaryColor}" opacity="0.5"/>
53
+ <rect x="${size / 2 - stripeWidth / 2}" y="0" width="${stripeWidth}" height="${size}" fill="${secondaryColor}" opacity="0.4"/>
54
+ <rect x="${size - stripeWidth}" y="0" width="${stripeWidth}" height="${size}" fill="${primaryColor}" opacity="0.5"/>
55
+ </svg>
56
+ `;
57
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
58
+ }
59
+
60
+ /**
61
+ * Generate Hadzabe pattern (Tanzania)
62
+ * Inspired by cave paintings and natural earth tones
63
+ * Hunter-gatherer tribe with ancient artistic traditions
64
+ */
65
+ export function generateHadzabe({
66
+ earthColor = '#8B4513',
67
+ ochreColor = '#CD853F',
68
+ charcoalColor = '#2F2F2F',
69
+ size = 50
70
+ } = {}) {
71
+ const svg = `
72
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
73
+ <rect width="${size}" height="${size}" fill="${earthColor}"/>
74
+ <!-- Cave art inspired figures -->
75
+ <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.08}" fill="${ochreColor}"/>
76
+ <line x1="${size * 0.3}" y1="${size * 0.38}" x2="${size * 0.3}" y2="${size * 0.6}" stroke="${charcoalColor}" stroke-width="2"/>
77
+ <line x1="${size * 0.2}" y1="${size * 0.45}" x2="${size * 0.4}" y2="${size * 0.45}" stroke="${charcoalColor}" stroke-width="2"/>
78
+ <!-- Animal figure -->
79
+ <ellipse cx="${size * 0.7}" cy="${size * 0.5}" rx="${size * 0.15}" ry="${size * 0.08}" fill="${ochreColor}"/>
80
+ <line x1="${size * 0.6}" y1="${size * 0.58}" x2="${size * 0.6}" y2="${size * 0.7}" stroke="${charcoalColor}" stroke-width="2"/>
81
+ <line x1="${size * 0.8}" y1="${size * 0.58}" x2="${size * 0.8}" y2="${size * 0.7}" stroke="${charcoalColor}" stroke-width="2"/>
82
+ <!-- Dots like ancient markings -->
83
+ <circle cx="${size * 0.15}" cy="${size * 0.8}" r="3" fill="${ochreColor}"/>
84
+ <circle cx="${size * 0.85}" cy="${size * 0.2}" r="3" fill="${ochreColor}"/>
85
+ </svg>
86
+ `;
87
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
88
+ }
89
+
90
+ /**
91
+ * Generate Kanga border pattern (Tanzania/Kenya)
92
+ */
93
+ export function generateKangaBorder({
94
+ primaryColor = '#1EB53A', // Simple Green (Tanzania)
95
+ accentColor = '#FCD116', // Gold
96
+ size = 30
97
+ } = {}) {
98
+ const svg = `
99
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
100
+ <rect width="${size}" height="${size}" fill="${primaryColor}"/>
101
+ <!-- Pindo (Border) Motifs: Cashew/Triangle -->
102
+ <path d="M0,0 L${size / 2},${size / 2} L0,${size} Z" fill="${accentColor}"/>
103
+ <path d="M${size},0 L${size / 2},${size / 2} L${size},${size} Z" fill="${accentColor}"/>
104
+ <circle cx="${size / 2}" cy="${size / 2}" r="${size * 0.15}" fill="none" stroke="${accentColor}" stroke-width="2"/>
105
+ </svg>
106
+ `;
107
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
108
+ }
109
+
110
+ /**
111
+ * Generate Kanga traditional Swahili cloth pattern (East Africa)
112
+ */
113
+ export function generateKanga({
114
+ primaryColor = '#FF6B00',
115
+ secondaryColor = '#002B5C',
116
+ backgroundColor = '#FFFFFF',
117
+ size = 40
118
+ } = {}) {
119
+ const svg = `
120
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
121
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
122
+ <!-- Border pattern -->
123
+ <rect x="0" y="0" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
124
+ <rect x="0" y="${size * 0.9}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
125
+ <rect x="0" y="0" width="${size * 0.1}" height="${size}" fill="${primaryColor}"/>
126
+ <rect x="${size * 0.9}" y="0" width="${size * 0.1}" height="${size}" fill="${primaryColor}"/>
127
+ <!-- Center motif -->
128
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.15}" fill="${secondaryColor}"/>
129
+ <text x="${size * 0.5}" y="${size * 0.55}" text-anchor="middle" fill="${primaryColor}" font-size="${size * 0.08}">KANGA</text>
130
+ </svg>
131
+ `;
132
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
133
+ }
134
+
135
+ /**
136
+ * Generate Kuba Border pattern (Congo)
137
+ */
138
+ export function generateKubaBorder({
139
+ primaryColor = '#8B4513',
140
+ secondaryColor = '#DAA520',
141
+ backgroundColor = '#F5F5DC',
142
+ size = 30
143
+ } = {}) {
144
+ const svg = `
145
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
146
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
147
+ <!-- Kuba geometric border -->
148
+ <polygon points="0,0 ${size * 0.3},0 0,${size * 0.3}" fill="${primaryColor}"/>
149
+ <polygon points="${size},0 ${size * 0.7},0 ${size},${size * 0.3}" fill="${primaryColor}"/>
150
+ <polygon points="0,${size} ${size * 0.3},${size} 0,${size * 0.7}" fill="${primaryColor}"/>
151
+ <polygon points="${size},${size} ${size * 0.7},${size} ${size},${size * 0.7}" fill="${primaryColor}"/>
152
+ <!-- Center diamond -->
153
+ <polygon points="${size * 0.5},${size * 0.3} ${size * 0.7},${size * 0.5} ${size * 0.5},${size * 0.7} ${size * 0.3},${size * 0.5}" fill="${secondaryColor}"/>
154
+ </svg>
155
+ `;
156
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
157
+ }
158
+
159
+ /**
160
+ * Generate Zulu Beads pattern (South Africa)
161
+ */
162
+ export function generateZuluBeads({
163
+ primaryColor = '#FF0000',
164
+ secondaryColor = '#000000',
165
+ accentColor = '#FFFFFF',
166
+ size = 40
167
+ } = {}) {
168
+ const svg = `
169
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
170
+ <rect width="${size}" height="${size}" fill="${accentColor}"/>
171
+ <!-- Bead pattern -->
172
+ <circle cx="${size * 0.2}" cy="${size * 0.2}" r="${size * 0.08}" fill="${primaryColor}"/>
173
+ <circle cx="${size * 0.5}" cy="${size * 0.2}" r="${size * 0.08}" fill="${secondaryColor}"/>
174
+ <circle cx="${size * 0.8}" cy="${size * 0.2}" r="${size * 0.08}" fill="${primaryColor}"/>
175
+ <circle cx="${size * 0.2}" cy="${size * 0.5}" r="${size * 0.08}" fill="${secondaryColor}"/>
176
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.08}" fill="${primaryColor}"/>
177
+ <circle cx="${size * 0.8}" cy="${size * 0.5}" r="${size * 0.08}" fill="${secondaryColor}"/>
178
+ <circle cx="${size * 0.2}" cy="${size * 0.8}" r="${size * 0.08}" fill="${primaryColor}"/>
179
+ <circle cx="${size * 0.5}" cy="${size * 0.8}" r="${size * 0.08}" fill="${secondaryColor}"/>
180
+ <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.08}" fill="${primaryColor}"/>
181
+ </svg>
182
+ `;
183
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
184
+ }
185
+
186
+ /**
187
+ * Generate Maasai Shield pattern (Kenya/Tanzania)
188
+ */
189
+ export function generateMasaiShield({
190
+ primaryColor = '#8B0000',
191
+ secondaryColor = '#FFD700',
192
+ backgroundColor = '#654321',
193
+ size = 50
194
+ } = {}) {
195
+ const svg = `
196
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
197
+ <ellipse cx="${size * 0.5}" cy="${size * 0.5}" rx="${size * 0.4}" ry="${size * 0.45}" fill="${backgroundColor}"/>
198
+ <!-- Shield patterns -->
199
+ <ellipse cx="${size * 0.5}" cy="${size * 0.3}" rx="${size * 0.2}" ry="${size * 0.15}" fill="${primaryColor}"/>
200
+ <rect x="${size * 0.4}" y="${size * 0.5}" width="${size * 0.2}" height="${size * 0.3}" fill="${secondaryColor}"/>
201
+ <!-- Decorative lines -->
202
+ <line x1="${size * 0.3}" y1="${size * 0.2}" x2="${size * 0.7}" y2="${size * 0.2}" stroke="${primaryColor}" stroke-width="3"/>
203
+ <line x1="${size * 0.3}" y1="${size * 0.8}" x2="${size * 0.7}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="3"/>
204
+ </svg>
205
+ `;
206
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
207
+ }
208
+
209
+ /**
210
+ * Generate Ndebele Paint house pattern (South Africa)
211
+ */
212
+ export function generateNdebelePaint({
213
+ primaryColor = '#FF1493',
214
+ secondaryColor = '#00FF00',
215
+ accentColor = '#FFFF00',
216
+ backgroundColor = '#FFFFFF',
217
+ size = 50
218
+ } = {}) {
219
+ const svg = `
220
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
221
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
222
+ <!-- Ndebele geometric patterns -->
223
+ <polygon points="${size * 0.2},${size * 0.2} ${size * 0.4},${size * 0.2} ${size * 0.3},${size * 0.4}" fill="${primaryColor}"/>
224
+ <polygon points="${size * 0.6},${size * 0.2} ${size * 0.8},${size * 0.2} ${size * 0.7},${size * 0.4}" fill="${secondaryColor}"/>
225
+ <polygon points="${size * 0.2},${size * 0.6} ${size * 0.4},${size * 0.6} ${size * 0.3},${size * 0.8}" fill="${accentColor}"/>
226
+ <polygon points="${size * 0.6},${size * 0.6} ${size * 0.8},${size * 0.6} ${size * 0.7},${size * 0.8}" fill="${primaryColor}"/>
227
+ <!-- Center design -->
228
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.15}" fill="${secondaryColor}"/>
229
+ <rect x="${size * 0.45}" y="${size * 0.45}" width="${size * 0.1}" height="${size * 0.1}" fill="${accentColor}"/>
230
+ </svg>
231
+ `;
232
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
233
+ }
234
+
235
+ /**
236
+ * Generate Kitenge floral pattern (East Africa)
237
+ */
238
+ export function generateKitenge({
239
+ primaryColor = '#00A3DD',
240
+ secondaryColor = '#FCD116',
241
+ backgroundColor = '#1EB53A',
242
+ size = 50
243
+ } = {}) {
244
+ const svg = `
245
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
246
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
247
+ <circle cx="${size * 0.25}" cy="${size * 0.25}" r="${size * 0.2}" fill="${primaryColor}" opacity="0.8"/>
248
+ <circle cx="${size * 0.75}" cy="${size * 0.75}" r="${size * 0.2}" fill="${primaryColor}" opacity="0.8"/>
249
+ <circle cx="${size * 0.25}" cy="${size * 0.25}" r="${size * 0.1}" fill="${secondaryColor}"/>
250
+ <circle cx="${size * 0.75}" cy="${size * 0.75}" r="${size * 0.1}" fill="${secondaryColor}"/>
251
+ <circle cx="${size * 0.75}" cy="${size * 0.25}" r="${size * 0.08}" fill="${secondaryColor}" opacity="0.6"/>
252
+ <circle cx="${size * 0.25}" cy="${size * 0.75}" r="${size * 0.08}" fill="${secondaryColor}" opacity="0.6"/>
253
+ </svg>
254
+ `;
255
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
256
+ }
257
+
258
+ // ============================================
259
+ // WEST AFRICAN PATTERNS
260
+ // ============================================
261
+
262
+ /**
263
+ * Generate Ghana Kente cloth pattern
264
+ * Royal cloth of the Ashanti people with geometric strips
265
+ * Colors: Gold (royalty), Green (harvest), Red (blood/sacrifice)
266
+ */
267
+ export function generateKente({
268
+ colors = ['#FFD700', '#228B22', '#DC143C', '#000000'],
269
+ size = 60
270
+ } = {}) {
271
+ const [gold, green, red, black] = colors;
272
+ const stripe = size / 6;
273
+
274
+ const svg = `
275
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
276
+ <rect width="${size}" height="${size}" fill="${black}"/>
277
+ <!-- Horizontal bands -->
278
+ <rect x="0" y="0" width="${size}" height="${stripe}" fill="${gold}"/>
279
+ <rect x="0" y="${stripe}" width="${size}" height="${stripe}" fill="${green}"/>
280
+ <rect x="0" y="${stripe * 2}" width="${size}" height="${stripe}" fill="${red}"/>
281
+ <rect x="0" y="${stripe * 3}" width="${size}" height="${stripe}" fill="${gold}"/>
282
+ <rect x="0" y="${stripe * 4}" width="${size}" height="${stripe}" fill="${green}"/>
283
+ <rect x="0" y="${stripe * 5}" width="${size}" height="${stripe}" fill="${red}"/>
284
+ <!-- Vertical accents -->
285
+ <rect x="${size * 0.2}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
286
+ <rect x="${size * 0.4}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
287
+ <rect x="${size * 0.6}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
288
+ <rect x="${size * 0.8}" y="0" width="3" height="${size}" fill="${black}" opacity="0.5"/>
289
+ <!-- Kente squares -->
290
+ <rect x="${size * 0.1}" y="${size * 0.1}" width="${size * 0.15}" height="${size * 0.15}" fill="${gold}" stroke="${black}" stroke-width="1"/>
291
+ <rect x="${size * 0.75}" y="${size * 0.75}" width="${size * 0.15}" height="${size * 0.15}" fill="${red}" stroke="${black}" stroke-width="1"/>
292
+ </svg>
293
+ `;
294
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
295
+ }
296
+
297
+ /**
298
+ * Generate Ghana Adinkra symbols pattern
299
+ * Philosophical symbols of the Akan people
300
+ * Each symbol represents concepts like wisdom, strength, unity
301
+ */
302
+ export function generateAdinkra({
303
+ symbolColor = '#000000',
304
+ backgroundColor = '#CD853F',
305
+ size = 50
306
+ } = {}) {
307
+ // Gye Nyame symbol (Supremacy of God) simplified
308
+ const svg = `
309
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
310
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
311
+ <!-- Sankofa-inspired heart shape (go back and get it) -->
312
+ <path d="M${size * 0.5} ${size * 0.2}
313
+ C${size * 0.3} ${size * 0.1} ${size * 0.15} ${size * 0.3} ${size * 0.25} ${size * 0.5}
314
+ L${size * 0.5} ${size * 0.8}
315
+ L${size * 0.75} ${size * 0.5}
316
+ C${size * 0.85} ${size * 0.3} ${size * 0.7} ${size * 0.1} ${size * 0.5} ${size * 0.2}"
317
+ fill="none" stroke="${symbolColor}" stroke-width="3"/>
318
+ <!-- Spiral detail -->
319
+ <circle cx="${size * 0.35}" cy="${size * 0.45}" r="${size * 0.08}" fill="none" stroke="${symbolColor}" stroke-width="2"/>
320
+ <circle cx="${size * 0.65}" cy="${size * 0.45}" r="${size * 0.08}" fill="none" stroke="${symbolColor}" stroke-width="2"/>
321
+ </svg>
322
+ `;
323
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
324
+ }
325
+
326
+ /**
327
+ * Generate Nigeria Aso-Oke pattern (Yoruba)
328
+ * Hand-woven cloth with intricate strip patterns
329
+ * Traditional for special occasions
330
+ */
331
+ export function generateAsoOke({
332
+ colors = ['#4B0082', '#FFD700', '#FFFFFF'],
333
+ size = 50
334
+ } = {}) {
335
+ const [indigo, gold, white] = colors;
336
+ const stripe = size / 10;
337
+
338
+ const svg = `
339
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
340
+ <rect width="${size}" height="${size}" fill="${indigo}"/>
341
+ <!-- Horizontal stripes -->
342
+ <rect x="0" y="${stripe}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
343
+ <rect x="0" y="${stripe * 3}" width="${size}" height="${stripe * 0.5}" fill="${white}"/>
344
+ <rect x="0" y="${stripe * 5}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
345
+ <rect x="0" y="${stripe * 7}" width="${size}" height="${stripe * 0.5}" fill="${white}"/>
346
+ <rect x="0" y="${stripe * 9}" width="${size}" height="${stripe * 0.5}" fill="${gold}"/>
347
+ <!-- Vertical accent lines -->
348
+ <rect x="${size * 0.48}" y="0" width="${stripe * 0.4}" height="${size}" fill="${gold}" opacity="0.7"/>
349
+ <!-- Diamond motifs -->
350
+ <polygon points="${size * 0.25},${size * 0.3} ${size * 0.35},${size * 0.5} ${size * 0.25},${size * 0.7} ${size * 0.15},${size * 0.5}"
351
+ fill="${gold}" stroke="${white}" stroke-width="1"/>
352
+ <polygon points="${size * 0.75},${size * 0.3} ${size * 0.85},${size * 0.5} ${size * 0.75},${size * 0.7} ${size * 0.65},${size * 0.5}"
353
+ fill="${gold}" stroke="${white}" stroke-width="1"/>
354
+ </svg>
355
+ `;
356
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
357
+ }
358
+
359
+ /**
360
+ * Generate Nigeria Ankara/African wax print pattern
361
+ * Bold, colorful designs popular across Africa
362
+ */
363
+ export function generateAnkara({
364
+ primaryColor = '#FF6B00',
365
+ secondaryColor = '#00A86B',
366
+ accentColor = '#FFD700',
367
+ backgroundColor = '#FFFFFF',
368
+ size = 60
369
+ } = {}) {
370
+ const svg = `
371
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
372
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
373
+ <!-- Bold circular motifs -->
374
+ <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.25}" fill="${primaryColor}"/>
375
+ <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.15}" fill="${secondaryColor}"/>
376
+ <circle cx="${size * 0.3}" cy="${size * 0.3}" r="${size * 0.08}" fill="${accentColor}"/>
377
+
378
+ <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.2}" fill="${secondaryColor}"/>
379
+ <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.1}" fill="${primaryColor}"/>
380
+
381
+ <!-- Connecting lines -->
382
+ <line x1="${size * 0.45}" y1="${size * 0.45}" x2="${size * 0.65}" y2="${size * 0.65}"
383
+ stroke="${primaryColor}" stroke-width="4"/>
384
+
385
+ <!-- Small dots -->
386
+ <circle cx="${size * 0.1}" cy="${size * 0.8}" r="${size * 0.05}" fill="${accentColor}"/>
387
+ <circle cx="${size * 0.9}" cy="${size * 0.2}" r="${size * 0.05}" fill="${accentColor}"/>
388
+ </svg>
389
+ `;
390
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
391
+ }
392
+
393
+ // ============================================
394
+ // CENTRAL & NORTH AFRICAN PATTERNS
395
+ // ============================================
396
+
397
+ /**
398
+ * Generate Bogolanfini (Mud Cloth) pattern (Mali)
399
+ * Geometric abstract designs in earth tones
400
+ */
401
+ export function generateBogolan({
402
+ primaryColor = '#000000',
403
+ secondaryColor = '#FFFFFF',
404
+ accentColor = '#8B4513',
405
+ size = 60
406
+ } = {}) {
407
+ const svg = `
408
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
409
+ <rect width="${size}" height="${size}" fill="${primaryColor}"/>
410
+ <!-- Zigzags -->
411
+ <polyline points="0,${size * 0.2} ${size * 0.25},0 ${size * 0.5},${size * 0.2} ${size * 0.75},0 ${size},${size * 0.2}"
412
+ fill="none" stroke="${secondaryColor}" stroke-width="3"/>
413
+ <polyline points="0,${size * 0.8} ${size * 0.25},${size} ${size * 0.5},${size * 0.8} ${size * 0.75},${size} ${size},${size * 0.8}"
414
+ fill="none" stroke="${secondaryColor}" stroke-width="3"/>
415
+ <!-- Crosses -->
416
+ <line x1="${size * 0.25}" y1="${size * 0.4}" x2="${size * 0.25}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
417
+ <line x1="${size * 0.15}" y1="${size * 0.5}" x2="${size * 0.35}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
418
+ <line x1="${size * 0.75}" y1="${size * 0.4}" x2="${size * 0.75}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
419
+ <line x1="${size * 0.65}" y1="${size * 0.5}" x2="${size * 0.85}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
420
+ <!-- Dots -->
421
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.08}" fill="${accentColor}"/>
422
+ </svg>
423
+ `;
424
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
425
+ }
426
+
427
+ /**
428
+ * Generate Kuba Shoowa pattern (DRC)
429
+ * Complex interlocking geometric shapes
430
+ */
431
+ export function generateKuba({
432
+ primaryColor = '#D2B48C',
433
+ secondaryColor = '#3E2723',
434
+ size = 60
435
+ } = {}) {
436
+ const svg = `
437
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
438
+ <rect width="${size}" height="${size}" fill="${primaryColor}"/>
439
+ <!-- Interlocking diamonds/rectangles -->
440
+ <rect x="${size * 0.1}" y="${size * 0.1}" width="${size * 0.3}" height="${size * 0.3}" fill="${secondaryColor}"/>
441
+ <rect x="${size * 0.6}" y="${size * 0.6}" width="${size * 0.3}" height="${size * 0.3}" fill="${secondaryColor}"/>
442
+ <rect x="${size * 0.6}" y="${size * 0.1}" width="${size * 0.3}" height="${size * 0.3}"
443
+ fill="none" stroke="${secondaryColor}" stroke-width="4"/>
444
+ <rect x="${size * 0.1}" y="${size * 0.6}" width="${size * 0.3}" height="${size * 0.3}"
445
+ fill="none" stroke="${secondaryColor}" stroke-width="4"/>
446
+ <!-- Center lines -->
447
+ <line x1="${size * 0.4}" y1="${size * 0.5}" x2="${size * 0.6}" y2="${size * 0.5}" stroke="${secondaryColor}" stroke-width="2"/>
448
+ <line x1="${size * 0.5}" y1="${size * 0.4}" x2="${size * 0.5}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
449
+ </svg>
450
+ `;
451
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
452
+ }
453
+
454
+ /**
455
+ * Generate Imigongo pattern (Rwanda)
456
+ * Spiral/Geometric ridges traditionally made from cow dung
457
+ */
458
+ export function generateImigongo({
459
+ primaryColor = '#000000',
460
+ secondaryColor = '#FFFFFF',
461
+ accentColor = '#B22222',
462
+ size = 60
463
+ } = {}) {
464
+ const svg = `
465
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
466
+ <rect width="${size}" height="${size}" fill="${secondaryColor}"/>
467
+ <!-- Spiral/Diamond Motif -->
468
+ <path d="M${size * 0.5} ${size * 0.1}
469
+ L${size * 0.9} ${size * 0.5}
470
+ L${size * 0.5} ${size * 0.9}
471
+ L${size * 0.1} ${size * 0.5} Z"
472
+ fill="${primaryColor}"/>
473
+ <path d="M${size * 0.5} ${size * 0.3}
474
+ L${size * 0.7} ${size * 0.5}
475
+ L${size * 0.5} ${size * 0.7}
476
+ L${size * 0.3} ${size * 0.5} Z"
477
+ fill="${secondaryColor}"/>
478
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${accentColor}"/>
479
+ </svg>
480
+ `;
481
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
482
+ }
483
+
484
+ /**
485
+ * Generate Ethiopian Tibeb pattern
486
+ * Vibrant woven geometric borders
487
+ */
488
+ export function generateTibeb({
489
+ colors = ['#009E60', '#FCDD09', '#EF3340'], // Ethiopian flag colors
490
+ backgroundColor = '#FFFFFF',
491
+ size = 40
492
+ } = {}) {
493
+ const [c1, c2, c3] = colors;
494
+ const svg = `
495
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
496
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
497
+ <!-- Diamond Chain -->
498
+ <polygon points="${size * 0.5},0 ${size},${size * 0.5} ${size * 0.5},${size} 0,${size * 0.5}"
499
+ fill="${c1}" opacity="0.2"/>
500
+ <polygon points="${size * 0.5},${size * 0.2} ${size * 0.8},${size * 0.5} ${size * 0.5},${size * 0.8} ${size * 0.2},${size * 0.5}"
501
+ fill="${c2}"/>
502
+ <rect x="${size * 0.4}" y="${size * 0.4}" width="${size * 0.2}" height="${size * 0.2}" fill="${c3}"/>
503
+ <!-- Side accents -->
504
+ <line x1="0" y1="0" x2="0" y2="${size}" stroke="${c1}" stroke-width="4"/>
505
+ <line x1="${size}" y1="0" x2="${size}" y2="${size}" stroke="${c1}" stroke-width="4"/>
506
+ </svg>
507
+ `;
508
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
509
+ }
510
+
511
+ // ============================================
512
+ // SOUTHERN AFRICAN PATTERNS
513
+ // ============================================
514
+
515
+ /**
516
+ * Generate Ndebele geometric mural pattern (South Africa)
517
+ */
518
+ export function generateNdebele({
519
+ colors = ['#FFD700', '#4169E1', '#FF69B4', '#228B22'],
520
+ size = 60,
521
+ strokeWidth = 2
522
+ } = {}) {
523
+ const [c1, c2, c3, c4] = colors;
524
+ const svg = `
525
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
526
+ <rect width="${size}" height="${size}" fill="#FFFFFF"/>
527
+ <rect x="${strokeWidth}" y="${strokeWidth}"
528
+ width="${size - strokeWidth * 2}" height="${size - strokeWidth * 2}"
529
+ fill="none" stroke="#000000" stroke-width="${strokeWidth}"/>
530
+ <rect x="${size * 0.15}" y="${size * 0.15}" width="${size * 0.35}" height="${size * 0.35}"
531
+ fill="${c1}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
532
+ <rect x="${size * 0.5}" y="${size * 0.15}" width="${size * 0.35}" height="${size * 0.35}"
533
+ fill="${c2}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
534
+ <rect x="${size * 0.15}" y="${size * 0.5}" width="${size * 0.35}" height="${size * 0.35}"
535
+ fill="${c3}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
536
+ <rect x="${size * 0.5}" y="${size * 0.5}" width="${size * 0.35}" height="${size * 0.35}"
537
+ fill="${c4}" stroke="#000000" stroke-width="${strokeWidth / 2}"/>
538
+ <polygon points="${size / 2},${size * 0.3} ${size * 0.7},${size / 2} ${size / 2},${size * 0.7} ${size * 0.3},${size / 2}"
539
+ fill="#FFFFFF" stroke="#000000" stroke-width="${strokeWidth}"/>
540
+ </svg>
541
+ `;
542
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
543
+ }
544
+
545
+ /**
546
+ * Generate Zulu beadwork pattern (South Africa)
547
+ * Traditional "love letter" beadwork with symbolic colors
548
+ * Colors carry deep meaning in Zulu courtship
549
+ */
550
+ export function generateZulu({
551
+ colors = ['#FFFFFF', '#000000', '#FF0000', '#00A86B', '#FFD700'],
552
+ size = 50
553
+ } = {}) {
554
+ const [white, black, red, green, gold] = colors;
555
+ const bead = size / 10;
556
+
557
+ const svg = `
558
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
559
+ <rect width="${size}" height="${size}" fill="${black}"/>
560
+ <!-- Triangle pattern (isivivane - sacred cairn) -->
561
+ <polygon points="${size * 0.5},${size * 0.1} ${size * 0.9},${size * 0.9} ${size * 0.1},${size * 0.9}"
562
+ fill="none" stroke="${white}" stroke-width="2"/>
563
+ <polygon points="${size * 0.5},${size * 0.25} ${size * 0.75},${size * 0.75} ${size * 0.25},${size * 0.75}"
564
+ fill="${red}"/>
565
+ <!-- Beadwork dots -->
566
+ <circle cx="${size * 0.5}" cy="${size * 0.35}" r="${bead}" fill="${white}"/>
567
+ <circle cx="${size * 0.35}" cy="${size * 0.6}" r="${bead}" fill="${green}"/>
568
+ <circle cx="${size * 0.65}" cy="${size * 0.6}" r="${bead}" fill="${gold}"/>
569
+ <circle cx="${size * 0.5}" cy="${size * 0.8}" r="${bead}" fill="${white}"/>
570
+ <!-- Border dots -->
571
+ <circle cx="${size * 0.1}" cy="${size * 0.1}" r="${bead * 0.7}" fill="${red}"/>
572
+ <circle cx="${size * 0.9}" cy="${size * 0.1}" r="${bead * 0.7}" fill="${green}"/>
573
+ </svg>
574
+ `;
575
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
576
+ }
577
+
578
+ /**
579
+ * Generate Swazi/Eswatini pattern
580
+ * Inspired by Ligwalagwala (purple-crested turaco) and royal patterns
581
+ * Traditional shields and ceremonial designs
582
+ */
583
+ export function generateSwazi({
584
+ colors = ['#3E5EB9', '#FECD00', '#B10C0C', '#FFFFFF'],
585
+ size = 50
586
+ } = {}) {
587
+ const [blue, gold, red, white] = colors;
588
+
589
+ const svg = `
590
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
591
+ <rect width="${size}" height="${size}" fill="${blue}"/>
592
+ <!-- Shield shape (central to Eswatini culture) -->
593
+ <ellipse cx="${size * 0.5}" cy="${size * 0.45}" rx="${size * 0.35}" ry="${size * 0.4}"
594
+ fill="${gold}" stroke="${red}" stroke-width="3"/>
595
+ <!-- Inner pattern -->
596
+ <ellipse cx="${size * 0.5}" cy="${size * 0.45}" rx="${size * 0.2}" ry="${size * 0.25}"
597
+ fill="${red}"/>
598
+ <!-- Feather accents -->
599
+ <line x1="${size * 0.5}" y1="${size * 0.05}" x2="${size * 0.5}" y2="${size * 0.2}"
600
+ stroke="${white}" stroke-width="3"/>
601
+ <line x1="${size * 0.4}" y1="${size * 0.08}" x2="${size * 0.45}" y2="${size * 0.15}"
602
+ stroke="${white}" stroke-width="2"/>
603
+ <line x1="${size * 0.6}" y1="${size * 0.08}" x2="${size * 0.55}" y2="${size * 0.15}"
604
+ stroke="${white}" stroke-width="2"/>
605
+ <!-- Spear points -->
606
+ <polygon points="${size * 0.1},${size * 0.3} ${size * 0.05},${size * 0.5} ${size * 0.15},${size * 0.5}" fill="${white}"/>
607
+ <polygon points="${size * 0.9},${size * 0.3} ${size * 0.85},${size * 0.5} ${size * 0.95},${size * 0.5}" fill="${white}"/>
608
+ </svg>
609
+ `;
610
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
611
+ }
612
+
613
+ /**
614
+ * Generate Xhosa pattern (South Africa)
615
+ * Inspired by traditional Xhosa beadwork and blanket designs
616
+ * Known for bold geometric patterns
617
+ */
618
+ export function generateXhosa({
619
+ primaryColor = '#FFFFFF',
620
+ accentColor = '#00A86B',
621
+ backgroundColor = '#1a1a2e',
622
+ size = 50
623
+ } = {}) {
624
+ const svg = `
625
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
626
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
627
+ <!-- Horizontal bands -->
628
+ <rect x="0" y="${size * 0.2}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
629
+ <rect x="0" y="${size * 0.7}" width="${size}" height="${size * 0.1}" fill="${primaryColor}"/>
630
+ <!-- Vertical bands -->
631
+ <rect x="${size * 0.2}" y="0" width="${size * 0.1}" height="${size}" fill="${accentColor}"/>
632
+ <rect x="${size * 0.7}" y="0" width="${size * 0.1}" height="${size}" fill="${accentColor}"/>
633
+ <!-- Central diamond -->
634
+ <polygon points="${size * 0.5},${size * 0.35} ${size * 0.65},${size * 0.5} ${size * 0.5},${size * 0.65} ${size * 0.35},${size * 0.5}"
635
+ fill="${accentColor}" stroke="${primaryColor}" stroke-width="2"/>
636
+ <!-- Corner triangles -->
637
+ <polygon points="0,0 ${size * 0.15},0 0,${size * 0.15}" fill="${accentColor}"/>
638
+ <polygon points="${size},0 ${size * 0.85},0 ${size},${size * 0.15}" fill="${accentColor}"/>
639
+ <polygon points="0,${size} ${size * 0.15},${size} 0,${size * 0.85}" fill="${accentColor}"/>
640
+ <polygon points="${size},${size} ${size * 0.85},${size} ${size},${size * 0.85}" fill="${accentColor}"/>
641
+ </svg>
642
+ `;
643
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
644
+ }
645
+
646
+ /**
647
+ * Apply pattern as background to an element
648
+ */
649
+ export function applyPattern(element, patternUrl) {
650
+ element.style.backgroundImage = `url("${patternUrl}")`;
651
+ element.style.backgroundRepeat = 'repeat';
652
+ }
653
+
654
+ // ============================================
655
+ // NORTH AFRICAN PATTERNS
656
+ // ============================================
657
+
658
+ /**
659
+ * Generate Berber pattern (North Africa)
660
+ * Geometric designs inspired by Amazigh rugs and tattoos
661
+ * Symbols of protection, fertility, and nature
662
+ */
663
+ export function generateBerber({
664
+ primaryColor = '#8B0000', // Deep red
665
+ secondaryColor = '#000000',
666
+ accentColor = '#FFD700',
667
+ backgroundColor = '#F5F5DC', // Beige/Wool
668
+ size = 60
669
+ } = {}) {
670
+ const svg = `
671
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
672
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
673
+ <!-- Lozenge (Diamond) - universal protective symbol -->
674
+ <polygon points="${size * 0.5},${size * 0.1} ${size * 0.9},${size * 0.5} ${size * 0.5},${size * 0.9} ${size * 0.1},${size * 0.5}"
675
+ fill="${primaryColor}" stroke="${secondaryColor}" stroke-width="2"/>
676
+ <!-- Inner geometric details -->
677
+ <line x1="${size * 0.5}" y1="${size * 0.1}" x2="${size * 0.5}" y2="${size * 0.9}" stroke="${accentColor}" stroke-width="2"/>
678
+ <line x1="${size * 0.1}" y1="${size * 0.5}" x2="${size * 0.9}" y2="${size * 0.5}" stroke="${accentColor}" stroke-width="2"/>
679
+ <!-- X symbols (Fibula/Cross) -->
680
+ <line x1="${size * 0.4}" y1="${size * 0.4}" x2="${size * 0.6}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
681
+ <line x1="${size * 0.6}" y1="${size * 0.4}" x2="${size * 0.4}" y2="${size * 0.6}" stroke="${secondaryColor}" stroke-width="2"/>
682
+ </svg>
683
+ `;
684
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
685
+ }
686
+
687
+ /**
688
+ * Generate Adire Oniko (Yoruba Indigo) pattern
689
+ * Resist-dyed circles and ripples
690
+ * "Tie and dye" technique simulation
691
+ */
692
+ export function generateAdire({
693
+ primaryColor = '#4B0082', // Indigo
694
+ secondaryColor = '#8A2BE2', // Light Indigo
695
+ accentColor = '#FFFFFF',
696
+ size = 50
697
+ } = {}) {
698
+ const svg = `
699
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
700
+ <rect width="${size}" height="${size}" fill="${primaryColor}"/>
701
+ <!-- Resist circles (Oniko) -->
702
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.35}" fill="none" stroke="${secondaryColor}" stroke-width="3"/>
703
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.25}" fill="none" stroke="${accentColor}" stroke-width="2" stroke-dasharray="4 2"/>
704
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${accentColor}" opacity="0.8"/>
705
+ <!-- Corner ripples -->
706
+ <path d="M0,0 Q${size * 0.2},0 ${size * 0.2},${size * 0.2} Q0,${size * 0.2} 0,0" fill="${secondaryColor}"/>
707
+ <path d="M${size},${size} Q${size * 0.8},${size} ${size * 0.8},${size * 0.8} Q${size},${size * 0.8} ${size},${size}" fill="${secondaryColor}"/>
708
+ </svg>
709
+ `;
710
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
711
+ }
712
+
713
+ // Export all generators
714
+ export default {
715
+ // East Africa
716
+ generatePolygon,
717
+ generateShuka,
718
+ generateHadzabe,
719
+ generateKanga,
720
+ generateKangaBorder,
721
+ generateKitenge,
722
+ generateMasaiShield,
723
+ generateTibeb, // Ethiopia
724
+ generateImigongo, // Rwanda
725
+ // West Africa
726
+ generateKente,
727
+ generateAdinkra,
728
+ generateAsoOke,
729
+ generateAnkara,
730
+ generateBogolan, // Mali/West
731
+ generateAdire, // Nigeria (Indigo)
732
+ // Central Africa
733
+ generateKuba, // DRC
734
+ generateKubaBorder,
735
+ // North Africa
736
+ generateBerber, // Amazigh
737
+ // Southern Africa
738
+ generateNdebele,
739
+ generateNdebelePaint,
740
+ generateZulu,
741
+ generateZuluBeads,
742
+ generateSwazi,
743
+ generateXhosa,
744
+ generateYorubaAdire,
745
+ generateAkanKente,
746
+ // Utilities
747
+ applyPattern,
748
+ // Tech Patterns
749
+ generateTuareg,
750
+ generateGeez,
751
+ generateBoli,
752
+ generateCircuit,
753
+ circuit: generateCircuit
754
+ };
755
+
756
+ /**
757
+ * Generate Tuareg Indigo pattern (Sahara/Berber)
758
+ * Inspired by the "Blue Men of the Sahara" and their geometric silver jewelry/stars
759
+ */
760
+ export function generateTuareg({
761
+ primaryColor = '#2D3D6B', // Tuareg Indigo
762
+ secondaryColor = '#6B8CC7', // Sky Blue
763
+ accentColor = '#FFFFFF', // Silver/White
764
+ size = 60
765
+ } = {}) {
766
+ const svg = `
767
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
768
+ <rect width="${size}" height="${size}" fill="${primaryColor}"/>
769
+ <!-- Southern Cross / Tuareg Star -->
770
+ <path d="M${size * 0.5} 0 L${size * 0.6} ${size * 0.4} L${size} ${size * 0.5} L${size * 0.6} ${size * 0.6} L${size * 0.5} ${size} L${size * 0.4} ${size * 0.6} L0 ${size * 0.5} L${size * 0.4} ${size * 0.4} Z"
771
+ fill="none" stroke="${accentColor}" stroke-width="2"/>
772
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${secondaryColor}"/>
773
+ </svg>
774
+ `;
775
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
776
+ }
777
+
778
+ /**
779
+ * Generate Ge'ez Script pattern (Ethiopia/Eritrea)
780
+ * Abstract calligraphic strokes inspired by one of the world's oldest scripts
781
+ */
782
+ export function generateGeez({
783
+ inkColor = '#3A2E2C',
784
+ parchmentColor = '#F4E4BC',
785
+ size = 50
786
+ } = {}) {
787
+ const svg = `
788
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
789
+ <rect width="${size}" height="${size}" fill="${parchmentColor}"/>
790
+ <path d="M${size * 0.2} ${size * 0.2} L${size * 0.4} ${size * 0.2} M${size * 0.3} ${size * 0.2} L${size * 0.3} ${size * 0.5} Q${size * 0.4} ${size * 0.6} ${size * 0.2} ${size * 0.7}"
791
+ fill="none" stroke="${inkColor}" stroke-width="3" stroke-linecap="round"/>
792
+ <path d="M${size * 0.6} ${size * 0.3} C${size * 0.8} ${size * 0.3} ${size * 0.8} ${size * 0.6} ${size * 0.6} ${size * 0.6} L${size * 0.8} ${size * 0.8}"
793
+ fill="none" stroke="${inkColor}" stroke-width="3" stroke-linecap="round"/>
794
+ </svg>
795
+ `;
796
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
797
+ }
798
+
799
+ /**
800
+ * Generate Boli pattern (Mali/Bambara)
801
+ * Abstract organic shapes inspired by mud-based ritual objects
802
+ */
803
+ export function generateBoli({
804
+ clayColor = '#4E342E',
805
+ earthColor = '#3E2723',
806
+ accentColor = '#BCAAA4',
807
+ size = 60
808
+ } = {}) {
809
+ const svg = `
810
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
811
+ <rect width="${size}" height="${size}" fill="${earthColor}"/>
812
+ <path d="M${size * 0.2} ${size * 0.5} Q${size * 0.3} ${size * 0.2} ${size * 0.5} ${size * 0.3} T${size * 0.8} ${size * 0.5} Q${size * 0.7} ${size * 0.8} ${size * 0.5} ${size * 0.7} T${size * 0.2} ${size * 0.5}"
813
+ fill="${clayColor}" stroke="${accentColor}" stroke-width="2"/>
814
+ </svg>
815
+ `;
816
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
817
+ }
818
+
819
+ export function generateCircuit({
820
+ primaryColor = '#334155',
821
+ secondaryColor = '#1e293b',
822
+ size = 100
823
+ } = {}) {
824
+ const svg = `
825
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 100 100">
826
+ <rect width="100" height="100" fill="${secondaryColor}"/>
827
+ <path d="M10 10 H90 V90 H10 Z" fill="none" stroke="${primaryColor}" stroke-width="0.5" opacity="0.3"/>
828
+ <path d="M20 20 V50 H50 V80 H80" fill="none" stroke="${primaryColor}" stroke-width="1"/>
829
+ <circle cx="20" cy="20" r="2" fill="${primaryColor}"/>
830
+ <circle cx="80" cy="80" r="2" fill="${primaryColor}"/>
831
+ <circle cx="50" cy="50" r="1.5" fill="${primaryColor}"/>
832
+ </svg>
833
+ `;
834
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
835
+ }
836
+
837
+ /**
838
+ * Generate Yoruba Adire pattern (Nigeria)
839
+
840
+ * Traditional resist-dyed cloth patterns
841
+
842
+ */
843
+
844
+ export function generateYorubaAdire({
845
+
846
+ primaryColor = '#000000',
847
+
848
+ secondaryColor = '#FCD116',
849
+
850
+ backgroundColor = '#FFFFFF',
851
+
852
+ size = 50
853
+
854
+ } = {}) {
855
+
856
+ const svg = `
857
+
858
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
859
+
860
+ <rect width="${size}" height="${size}" fill="${backgroundColor}"/>
861
+
862
+ <!-- Adire tie-dye circles -->
863
+
864
+ <circle cx="${size * 0.2}" cy="${size * 0.2}" r="${size * 0.15}" fill="${primaryColor}"/>
865
+
866
+ <circle cx="${size * 0.8}" cy="${size * 0.2}" r="${size * 0.15}" fill="${primaryColor}"/>
867
+
868
+ <circle cx="${size * 0.2}" cy="${size * 0.8}" r="${size * 0.15}" fill="${primaryColor}"/>
869
+
870
+ <circle cx="${size * 0.8}" cy="${size * 0.8}" r="${size * 0.15}" fill="${primaryColor}"/>
871
+
872
+ <circle cx="${size * 0.5}" cy="${size * 0.5}" r="${size * 0.1}" fill="${secondaryColor}"/>
873
+
874
+ <!-- Connecting lines -->
875
+
876
+ <line x1="${size * 0.2}" y1="${size * 0.2}" x2="${size * 0.8}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="2"/>
877
+
878
+ <line x1="${size * 0.8}" y1="${size * 0.2}" x2="${size * 0.2}" y2="${size * 0.8}" stroke="${primaryColor}" stroke-width="2"/>
879
+
880
+ </svg>
881
+
882
+ `;
883
+
884
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
885
+
886
+ }
887
+
888
+ /**
889
+
890
+ * Generate Akan Kente pattern variation (Ghana)
891
+
892
+ * Geometric patterns with cultural significance
893
+
894
+ */
895
+
896
+ export function generateAkanKente({
897
+
898
+ colors = ['#000000', '#FCD116', '#E82127', '#006B3F'],
899
+
900
+ size = 60
901
+
902
+ } = {}) {
903
+
904
+ const [black, gold, red, green] = colors;
905
+
906
+ const stripe = size / 6;
907
+
908
+ const svg = `
909
+
910
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
911
+
912
+ <rect width="${size}" height="${size}" fill="${gold}"/>
913
+
914
+ <!-- Horizontal black stripes -->
915
+
916
+ <rect x="0" y="0" width="${size}" height="${stripe}" fill="${black}"/>
917
+
918
+ <rect x="0" y="${stripe * 2}" width="${size}" height="${stripe}" fill="${black}"/>
919
+
920
+ <rect x="0" y="${stripe * 4}" width="${size}" height="${stripe}" fill="${black}"/>
921
+
922
+ <!-- Vertical red stripes -->
923
+
924
+ <rect x="0" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
925
+
926
+ <rect x="${stripe * 2}" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
927
+
928
+ <rect x="${stripe * 4}" y="0" width="${stripe}" height="${size}" fill="${red}" opacity="0.6"/>
929
+
930
+ <!-- Green corner squares -->
931
+
932
+ <rect x="0" y="0" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
933
+
934
+ <rect x="${size - stripe * 0.8}" y="0" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
935
+
936
+ <rect x="0" y="${size - stripe * 0.8}" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
937
+
938
+ <rect x="${size - stripe * 0.8}" y="${size - stripe * 0.8}" width="${stripe * 0.8}" height="${stripe * 0.8}" fill="${green}"/>
939
+
940
+ </svg>
941
+
942
+ `;
943
+
944
+ return `data:image/svg+xml,${encodeURIComponent(svg.trim())}`;
945
+
946
+ }
947
+