colorDarken

🌑 Decreases the lightness of a color.

Syntax

TypeScript
import { colorDarken } from '@opentf/std';
colorDarken({ value: ColorInput; amount: number; to?: ColorFormat }): any
  • value: The input color.

  • amount: A number between 0 and 1.

  • to: The output format (default: 'hex').

Examples

TypeScript
colorDarken({ value: '#fff', amount: 0.5 }); //=> '#808080'
colorDarken({ value: 'red', amount: 0.2 }); //=> '#990000'
colorDarken({ value: 'red', amount: 0.2, to: 'rgba' }); //=> 'rgba(153, 0, 0, 1)'

Try it

Last updated on
Edit this page