colorAlpha
👻 Adjusts the alpha channel of a color.
Syntax
TypeScript
import { colorAlpha } from '@opentf/std'; colorAlpha({ value: ColorInput; amount: number; to?: ColorFormat }): any
value: The input color.amount: A number between0and1.to: The output format (default:'hex').
Examples
TypeScript
colorAlpha({ value: 'red', amount: 0.5 }); //=> '#ff000080' colorAlpha({ value: 'red', amount: 0.5, to: 'rgba' }); //=> 'rgba(255, 0, 0, 0.5)'