* Returns an HWB color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.hwb() // [201, 0.21, 0.31] * faker.color.hwb({ format: 'decimal' }) // [201, 0.21, 0.31] * faker.color.hwb({ f
(
options: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
} = {}
)
| 709 | * @since 7.0.0 |
| 710 | */ |
| 711 | hwb( |
| 712 | options: { |
| 713 | /** |
| 714 | * Format of generated RGB color. |
| 715 | * |
| 716 | * @default 'decimal' |
| 717 | */ |
| 718 | format?: ColorFormat; |
| 719 | } = {} |
| 720 | ): string | number[] { |
| 721 | const { format = 'decimal' } = options; |
| 722 | const hsl: number[] = [this.faker.number.int(360)]; |
| 723 | for (let i = 0; i < 2; i++) { |
| 724 | hsl.push(this.faker.number.float({ multipleOf: 0.01 })); |
| 725 | } |
| 726 | |
| 727 | return toColorFormat(hsl, format, 'hwb'); |
| 728 | } |
| 729 | |
| 730 | /** |
| 731 | * Returns a LAB (CIELAB) color. |
no test coverage detected