MCPcopy
hub / github.com/faker-js/faker / hwb

Method hwb

src/modules/color/index.ts:711–728  ·  view source on GitHub ↗

* 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;
    } = {}
  )

Source from the content-addressed store, hash-verified

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.

Callers 1

color.spec.tsFile · 0.80

Calls 3

toColorFormatFunction · 0.85
intMethod · 0.80
floatMethod · 0.80

Tested by

no test coverage detected