meo-canvas
    Preparing search index...

    Function parseColor

    • The channels of a colour string, or null where it is not a colour.

      null rather than a throw, because asking whether a string is a colour is the ordinary case and an exception is a poor way to answer a question. Use isColor where only the answer matters.

      Parameters

      • css: string

      Returns Rgba | null

      import { formatColor, mixColor, parseColor } from 'meo-canvas'

      const from = parseColor('#f2aa4c')
      const to = parseColor('rebeccapurple')
      if (from && to) formatColor(mixColor(from, to, 0.5))