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