PixiDom - v1.0.0
    Preparing search index...

    Function normalizeColor

    • Normalize any Color input to a { value, alpha } pair suitable for the underlying PIXI Graphics / TextStyle / tint APIs.

      Throws a TypeError on unrecognized or malformed inputs (e.g. null, '#zz', { r: 1 } missing g/b). Out-of-range channel values are clamped.

      Parameters

      Returns NormalizedColor

      normalizeColor(0xff0000);              // { value: 0xff0000, alpha: 1 }
      normalizeColor('#ff0000'); // { value: 0xff0000, alpha: 1 }
      normalizeColor('#f00'); // { value: 0xff0000, alpha: 1 }
      normalizeColor('#ff000080'); // { value: 0xff0000, alpha ≈ 0.5 }
      normalizeColor({ r: 255, g: 0, b: 0 }); // { value: 0xff0000, alpha: 1 }
      normalizeColor({ r: 255, g: 0, b: 0, a: 0.5 });// { value: 0xff0000, alpha: 0.5 }
      normalizeColor([255, 0, 0]); // { value: 0xff0000, alpha: 1 }
      normalizeColor([255, 0, 0, 0.25]); // { value: 0xff0000, alpha: 0.25 }