Colors
colorAlpha

👻 Adjusts the alpha channel of a color.

Syntax

import { colorAlpha } from '@opentf/std';
 
colorAlpha(input: ColorInput, amount: number, format?: ColorFormat): any
  • amount: A number between 0 and 1.
  • format: The output format (default: 'hex').

Examples

colorAlpha('red', 0.5); //=> '#ff000080'
colorAlpha('red', 0.5, 'rgba'); //=> 'rgba(255, 0, 0, 0.5)'

Try