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

Method hsl

src/modules/color/index.ts:610–623  ·  view source on GitHub ↗
(
    options: {
      format?: ColorFormat;
      includeAlpha?: boolean;
    } = {}
  )

Source from the content-addressed store, hash-verified

608 includeAlpha?: boolean;
609 }): string | number[];
610 hsl(
611 options: {
612 format?: ColorFormat;
613 includeAlpha?: boolean;
614 } = {}
615 ): string | number[] {
616 const { format = 'decimal', includeAlpha = false } = options;
617 const hsl: number[] = [this.faker.number.int(360)];
618 for (let i = 0; i < (options?.includeAlpha ? 3 : 2); i++) {
619 hsl.push(this.faker.number.float({ multipleOf: 0.01 }));
620 }
621
622 return toColorFormat(hsl, format, includeAlpha ? 'hsla' : 'hsl');
623 }
624
625 /**
626 * Returns an HWB 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