/** Resolve any ColorInput to a packed 24-bit integer. */
export function packColor(color) {
  return Bun.color(color, "number") ?? 0;
}

/** Lerp between two colors. Accepts and returns any ColorInput-compatible value. */
export function lerpColor(from, to, t) {
  const fromInt = packColor(from),
    toInt = packColor(to);
  const fromR = fromInt >> 16 & 0xff,
    fromG = fromInt >> 8 & 0xff,
    fromB = fromInt & 0xff;
  const toR = toInt >> 16 & 0xff,
    toG = toInt >> 8 & 0xff,
    toB = toInt & 0xff;
  return Math.round(fromR + (toR - fromR) * t) << 16 | Math.round(fromG + (toG - fromG) * t) << 8 | Math.round(fromB + (toB - fromB) * t);
}

/** Lighten a color by +30 per channel, clamped to 255. */
export function lighten(color) {
  const packed = packColor(color);
  const red = Math.min(255, (packed >> 16 & 0xff) + 30);
  const green = Math.min(255, (packed >> 8 & 0xff) + 30);
  const blue = Math.min(255, (packed & 0xff) + 30);
  return red << 16 | green << 8 | blue;
}
//# sourceMappingURL=utils.jsx.map
