👻 Adjusts the alpha channel of a color.

Syntax

TypeScript
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

TypeScript
colorAlpha('red', 0.5); //=> '#ff000080'
colorAlpha('red', 0.5, 'rgba'); //=> 'rgba(255, 0, 0, 0.5)'
Last updated on
Edit this page