Function opacity

Returns a variation of colour with its opacity multiplied by amt.

// Return a colour string for blue that is 50% opaque
opacity(`blue`, 0.5);
// eg: `rgba(0,0,255,0.5)`

// Returns a colour string that is 50% more opaque
opacity(`hsla(200,100%,50%,50%`, 0.5);
// eg: `hsla(200,100%,50%,25%)`

Named colours

  • Parameters

    • colour: Colourish

      A valid CSS colour

    • amt: number

      Amount to multiply opacity by

    Returns string

    String representation of colour