asciify-engine 1.0.22 → 1.0.23

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.
package/dist/index.cjs CHANGED
@@ -398,7 +398,7 @@ function renderWaveBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
398
398
  lineHeightRatio = 1.4,
399
399
  chars = " .:-=+*#%@",
400
400
  baseColor = null,
401
- accentColor = "#d4ff00",
401
+ accentColor = void 0,
402
402
  accentThreshold = 0.52,
403
403
  mouseInfluence = 0.55,
404
404
  mouseFalloff = 2.8,
@@ -408,6 +408,7 @@ function renderWaveBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
408
408
  breathe = true,
409
409
  lightMode = false
410
410
  } = options;
411
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
411
412
  const charW = fontSize * charAspect;
412
413
  const lineH = fontSize * lineHeightRatio;
413
414
  const cols = Math.ceil(width / charW);
@@ -415,8 +416,8 @@ function renderWaveBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
415
416
  const mx = mousePos.x;
416
417
  const my = mousePos.y;
417
418
  let acR = 212, acG = 255, acB = 0;
418
- if (accentColor) {
419
- const hex = accentColor.replace("#", "");
419
+ {
420
+ const hex = resolvedAccent.replace("#", "");
420
421
  if (hex.length === 6) {
421
422
  acR = parseInt(hex.slice(0, 2), 16);
422
423
  acG = parseInt(hex.slice(2, 4), 16);
@@ -1026,13 +1027,14 @@ function renderRainBackground(ctx, width, height, time, options = {}) {
1026
1027
  const {
1027
1028
  fontSize = 13,
1028
1029
  chars = "0123456789ABCDEF@#$&*+=/<>",
1029
- accentColor = "#d4ff00",
1030
+ accentColor = void 0,
1030
1031
  color,
1031
1032
  speed = 1,
1032
1033
  density = 0.55,
1033
1034
  tailLength = 14,
1034
1035
  lightMode = false
1035
1036
  } = options;
1037
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1036
1038
  const charW = fontSize * 0.62;
1037
1039
  const lineH = fontSize * 1.4;
1038
1040
  const cols = Math.ceil(width / charW);
@@ -1055,7 +1057,7 @@ function renderRainBackground(ctx, width, height, time, options = {}) {
1055
1057
  }
1056
1058
  }
1057
1059
  let acR = 212, acG = 255, acB = 0;
1058
- const ap = parseColor(accentColor);
1060
+ const ap = parseColor(resolvedAccent);
1059
1061
  if (ap) {
1060
1062
  acR = ap.r;
1061
1063
  acG = ap.g;
@@ -1091,12 +1093,13 @@ function renderStarsBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1091
1093
  const {
1092
1094
  fontSize = 14,
1093
1095
  chars = " . \xB7 * + \xB0 \u2605",
1094
- accentColor = "#d4ff00",
1096
+ accentColor = void 0,
1095
1097
  color,
1096
1098
  speed = 1,
1097
1099
  count = 180,
1098
1100
  lightMode = false
1099
1101
  } = options;
1102
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1100
1103
  ctx.clearRect(0, 0, width, height);
1101
1104
  ctx.textBaseline = "middle";
1102
1105
  ctx.textAlign = "center";
@@ -1118,7 +1121,7 @@ function renderStarsBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1118
1121
  }
1119
1122
  }
1120
1123
  let acR = 212, acG = 255, acB = 0;
1121
- const ap = parseColor(accentColor);
1124
+ const ap = parseColor(resolvedAccent);
1122
1125
  if (ap) {
1123
1126
  acR = ap.r;
1124
1127
  acG = ap.g;
@@ -1151,13 +1154,14 @@ function renderPulseBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1151
1154
  const {
1152
1155
  fontSize = 14,
1153
1156
  chars = ". \xB7 \u25CB \u25CE \u25CF",
1154
- accentColor = "#00ffcc",
1157
+ accentColor = void 0,
1155
1158
  color,
1156
1159
  rings = 5,
1157
1160
  speed = 1,
1158
1161
  sharpness = 4,
1159
1162
  lightMode = false
1160
1163
  } = options;
1164
+ const resolvedAccent = accentColor ?? (lightMode ? "#007a5e" : "#00ffcc");
1161
1165
  ctx.clearRect(0, 0, width, height);
1162
1166
  ctx.textBaseline = "middle";
1163
1167
  ctx.textAlign = "center";
@@ -1179,7 +1183,7 @@ function renderPulseBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1179
1183
  }
1180
1184
  }
1181
1185
  let acR = 0, acG = 255, acB = 204;
1182
- const ap = parseColor(accentColor);
1186
+ const ap = parseColor(resolvedAccent);
1183
1187
  if (ap) {
1184
1188
  acR = ap.r;
1185
1189
  acG = ap.g;
@@ -1224,7 +1228,7 @@ function renderNoiseBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1224
1228
  const {
1225
1229
  fontSize = 14,
1226
1230
  chars = " .\xB7:;=+*#%@\u2591\u2592\u2593",
1227
- accentColor = "#d4ff00",
1231
+ accentColor = void 0,
1228
1232
  color,
1229
1233
  octaves = 4,
1230
1234
  speed = 1,
@@ -1233,6 +1237,7 @@ function renderNoiseBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1233
1237
  mouseWarp = 0.3,
1234
1238
  lightMode = false
1235
1239
  } = options;
1240
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1236
1241
  const charW = fontSize * 0.62;
1237
1242
  const lineH = fontSize * 1.4;
1238
1243
  const cols = Math.ceil(width / charW);
@@ -1255,7 +1260,7 @@ function renderNoiseBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1255
1260
  }
1256
1261
  }
1257
1262
  let acR = 212, acG = 255, acB = 0;
1258
- const ap = parseColor(accentColor);
1263
+ const ap = parseColor(resolvedAccent);
1259
1264
  if (ap) {
1260
1265
  acR = ap.r;
1261
1266
  acG = ap.g;
@@ -1303,7 +1308,7 @@ function renderGridBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1303
1308
  const {
1304
1309
  fontSize = 12,
1305
1310
  chars = "\xB7-=+|/",
1306
- accentColor = "#d4ff00",
1311
+ accentColor = void 0,
1307
1312
  color,
1308
1313
  bands = 3,
1309
1314
  speed = 1,
@@ -1311,6 +1316,7 @@ function renderGridBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1311
1316
  glitch = true,
1312
1317
  lightMode = false
1313
1318
  } = options;
1319
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1314
1320
  const charW = fontSize * 0.62;
1315
1321
  const lineH = fontSize * 1.4;
1316
1322
  const cols = Math.ceil(width / charW);
@@ -1333,7 +1339,7 @@ function renderGridBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1333
1339
  }
1334
1340
  }
1335
1341
  let acR = 212, acG = 255, acB = 0;
1336
- const ap = parseColor(accentColor);
1342
+ const ap = parseColor(resolvedAccent);
1337
1343
  if (ap) {
1338
1344
  acR = ap.r;
1339
1345
  acG = ap.g;
@@ -1375,13 +1381,14 @@ function renderAuroraBackground(ctx, width, height, time, mousePos = { x: 0.5, y
1375
1381
  fontSize = 14,
1376
1382
  chars = " \xB7\u2219\u2022:;+=\u2261\u2263#@",
1377
1383
  color,
1378
- accentColor = "#d4ff00",
1384
+ accentColor = void 0,
1379
1385
  speed = 1,
1380
1386
  layers = 5,
1381
1387
  softness = 1.2,
1382
1388
  mouseRipple = 0.2,
1383
1389
  lightMode = false
1384
1390
  } = options;
1391
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1385
1392
  const charW = fontSize * 0.62;
1386
1393
  const lineH = fontSize * 1.4;
1387
1394
  const cols = Math.ceil(width / charW);
@@ -1404,7 +1411,7 @@ function renderAuroraBackground(ctx, width, height, time, mousePos = { x: 0.5, y
1404
1411
  }
1405
1412
  }
1406
1413
  let acR = 212, acG = 255, acB = 0;
1407
- const ap = parseColor(accentColor);
1414
+ const ap = parseColor(resolvedAccent);
1408
1415
  if (ap) {
1409
1416
  acR = ap.r;
1410
1417
  acG = ap.g;
@@ -1460,12 +1467,13 @@ function renderSilkBackground(ctx, width, height, time, options = {}) {
1460
1467
  const {
1461
1468
  fontSize = 13,
1462
1469
  color,
1463
- accentColor = "#d4ff00",
1470
+ accentColor = void 0,
1464
1471
  speed = 0.4,
1465
1472
  layers = 4,
1466
1473
  turbulence = 0.8,
1467
1474
  lightMode = false
1468
1475
  } = options;
1476
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1469
1477
  const charW = fontSize * 0.62;
1470
1478
  const lineH = fontSize * 1.4;
1471
1479
  const cols = Math.ceil(width / charW);
@@ -1488,7 +1496,7 @@ function renderSilkBackground(ctx, width, height, time, options = {}) {
1488
1496
  }
1489
1497
  }
1490
1498
  let acR = 212, acG = 255, acB = 0;
1491
- const ap = parseColor(accentColor);
1499
+ const ap = parseColor(resolvedAccent);
1492
1500
  if (ap) {
1493
1501
  acR = ap.r;
1494
1502
  acG = ap.g;
@@ -1535,12 +1543,13 @@ function renderVoidBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1535
1543
  fontSize = 13,
1536
1544
  chars = " \xB7:;=+*#%@",
1537
1545
  color,
1538
- accentColor = "#d4ff00",
1546
+ accentColor = void 0,
1539
1547
  speed = 1,
1540
1548
  radius = 0.38,
1541
1549
  swirl = 3,
1542
1550
  lightMode = false
1543
1551
  } = options;
1552
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1544
1553
  const charW = fontSize * 0.62;
1545
1554
  const lineH = fontSize * 1.4;
1546
1555
  const cols = Math.ceil(width / charW);
@@ -1564,7 +1573,7 @@ function renderVoidBackground(ctx, width, height, time, mousePos = { x: 0.5, y:
1564
1573
  }
1565
1574
  }
1566
1575
  let acR = 212, acG = 255, acB = 0;
1567
- const ap = parseColor(accentColor);
1576
+ const ap = parseColor(resolvedAccent);
1568
1577
  if (ap) {
1569
1578
  acR = ap.r;
1570
1579
  acG = ap.g;
@@ -1608,11 +1617,12 @@ function renderMorphBackground(ctx, width, height, time, options = {}) {
1608
1617
  fontSize = 14,
1609
1618
  chars = " \xB7\u2219\u2022:-=+*#",
1610
1619
  color,
1611
- accentColor = "#d4ff00",
1620
+ accentColor = void 0,
1612
1621
  speed = 0.5,
1613
1622
  harmonics = 3,
1614
1623
  lightMode = false
1615
1624
  } = options;
1625
+ const resolvedAccent = accentColor ?? (lightMode ? "#6b8700" : "#d4ff00");
1616
1626
  const charW = fontSize * 0.62;
1617
1627
  const lineH = fontSize * 1.4;
1618
1628
  const cols = Math.ceil(width / charW);
@@ -1635,7 +1645,7 @@ function renderMorphBackground(ctx, width, height, time, options = {}) {
1635
1645
  }
1636
1646
  }
1637
1647
  let acR = 212, acG = 255, acB = 0;
1638
- const ap = parseColor(accentColor);
1648
+ const ap = parseColor(resolvedAccent);
1639
1649
  if (ap) {
1640
1650
  acR = ap.r;
1641
1651
  acG = ap.g;