meo-canvas - v9.0.1
    Preparing search index...

    Function mixColor

    • Blends two colours, in any accepted format, and returns one string.

      Interpolation happens in sRGB with a straight alpha, which is what the canvas compositing model expects. t is clamped, so a track that overshoots cannot produce an impossible colour.

      Parameters

      • from: string
      • to: string
      • t: number

      Returns string

      mixColor('#000000', '#ffffff', 0.5) // '#808080'
      mixColor('red', 'blue', 0.25) // a quarter of the way from red to blue