stripAlpha

ColorPicker
stable

Remove the alpha channel from a colour object when the stripAlpha flag is true. Returns the original object unchanged when the flag is false.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

color
requis
any
A colour object such as THSVA, TRGBA or THSLA. The function shallow-clones it before deleting the `a` property so the original is not mutated.
stripAlpha
requis
boolean
When true the `a` key is removed from the cloned colour. When false the original colour is returned as-is.

API

Valeur de retour

La valeur retournée par cet util.

A shallow clone of the colour without the `a` property (stripAlpha=true), or the unchanged colour object (stripAlpha=false).

Usage

Exemples

Extraits de code prêts à coller.

Stripping alpha from an HSV colour

typescript