@hncode/hncode 0.8.2 → 0.8.3

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/src/animate.js CHANGED
@@ -327,6 +327,27 @@ export function lightAt(phaseMs, index, count, edge = 'cosine', stepMs = STEP_MS
327
327
  * @param {string} edge shoulder shape: 'cosine' (default) or 'linear'
328
328
  * @returns {string} ANSI, ready to splice into a row
329
329
  */
330
+ /**
331
+ * The glint for a base colour: the same hue, lifted part-way to white.
332
+ *
333
+ * The light that travels across a word must be a SHADE of the word, not another colour.
334
+ * `[255, 240, 120]` against orange reads as "this text is yellow now" — a status change —
335
+ * while a few percent of lift reads as a sheen passing over.
336
+ *
337
+ * Derived rather than fixed because the base is not fixed: the Working row turns blue while
338
+ * a compaction runs. A single hard-coded warm glint stayed yellow over that blue base, which
339
+ * is two colours fighting rather than one highlight.
340
+ */
341
+ export const GLINT_LIFT = 0.45;
342
+ export function glintFor(base) {
343
+ const b = Array.isArray(base) ? base : [255, 140, 0];
344
+ return [
345
+ Math.round(b[0] + (255 - b[0]) * GLINT_LIFT),
346
+ Math.round(b[1] + (255 - b[1]) * GLINT_LIFT),
347
+ Math.round(b[2] + (255 - b[2]) * GLINT_LIFT),
348
+ ];
349
+ }
350
+
330
351
  export function shimmerText(text, phaseMs, base, glint, edge = 'cosine', stepMs = STEP_MS) {
331
352
  const s = String(text == null ? '' : text);
332
353
  const n = s.length;