Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: jsdoc for options #1644

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 218 additions & 14 deletions src/modules/color/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,29 @@ export class ColorModule {
* @since 7.0.0
*/
rgb(options?: {
/**
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
* Prefix of the generated hex color. Only applied when 'hex' format is used.
*
* @default '0x'
*/
prefix?: string;
/**
* Letter type case of the generated hex color. Only applied when `'hex'` format is used.
*
* @default 'mixed'
*/
casing?: Casing;
/**
* Format of generated RGB color.
*
* @default 'hex'
*/
format?: 'hex' | StringColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): string;
/**
Expand All @@ -269,7 +289,17 @@ export class ColorModule {
* @since 7.0.0
*/
rgb(options?: {
/**
* Format of generated RGB color.
*
* @default 'hex'
*/
format?: NumberColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): number[];
/**
Expand All @@ -296,9 +326,29 @@ export class ColorModule {
* @since 7.0.0
*/
rgb(options?: {
/**
* Prefix of the generated hex color. Only applied when `'hex'` format is used.
*
* @default '0x'
*/
prefix?: string;
/**
* Letter type case of the generated hex color. Only applied when `'hex'` format is used.
*
* @default 'mixed'
*/
casing?: Casing;
/**
* Format of generated RGB color.
*
* @default 'hex'
*/
format?: 'hex' | ColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): string | number[];
rgb(options?: {
Expand Down Expand Up @@ -356,7 +406,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
cmyk(options?: { format?: StringColorFormat }): string;
cmyk(options?: {
/**
* Format of generated CMYK color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
}): string;
/**
* Returns a CMYK color.
*
Expand All @@ -369,7 +426,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
cmyk(options?: { format?: NumberColorFormat }): number[];
cmyk(options?: {
/**
* Format of generated CMYK color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
}): number[];
/**
* Returns a CMYK color.
*
Expand All @@ -384,7 +448,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
cmyk(options?: { format?: ColorFormat }): string | number[];
cmyk(options?: {
/**
* Format of generated CMYK color.
*
* @default 'decimal'
*/
format?: ColorFormat;
}): string | number[];
cmyk(options?: { format?: ColorFormat }): string | number[] {
const color: string | number[] = Array.from({ length: 4 }, () =>
this.faker.number.float()
Expand Down Expand Up @@ -417,7 +488,20 @@ export class ColorModule {
*
* @since 7.0.0
*/
hsl(options?: { format?: StringColorFormat; includeAlpha?: boolean }): string;
hsl(options?: {
/**
* Format of generated HSL color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): string;
/**
* Returns an HSL color.
*
Expand All @@ -433,7 +517,17 @@ export class ColorModule {
* @since 7.0.0
*/
hsl(options?: {
/**
* Format of generated HSL color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): number[];
/**
Expand All @@ -455,7 +549,17 @@ export class ColorModule {
* @since 7.0.0
*/
hsl(options?: {
/**
* Format of generated HSL color.
*
* @default 'decimal'
*/
format?: ColorFormat;
/**
* Adds an alpha value to the color (RGBA).
*
* @default false
*/
includeAlpha?: boolean;
}): string | number[];
hsl(options?: {
Expand Down Expand Up @@ -496,7 +600,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
hwb(options?: { format?: StringColorFormat }): string;
hwb(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
}): string;
/**
* Returns an HWB color.
*
Expand All @@ -509,7 +620,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
hwb(options?: { format?: NumberColorFormat }): number[];
hwb(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
}): number[];
/**
* Returns an HWB color.
*
Expand All @@ -524,7 +642,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
hwb(options?: { format?: ColorFormat }): string | number[];
hwb(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
}): string | number[];
/**
* Returns an HWB color.
*
Expand All @@ -539,7 +664,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
hwb(options?: { format?: ColorFormat }): string | number[] {
hwb(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
}): string | number[] {
const hsl: number[] = [this.faker.number.int(360)];
for (let i = 0; i < 2; i++) {
hsl.push(this.faker.number.float());
Expand Down Expand Up @@ -570,7 +702,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lab(options?: { format?: StringColorFormat }): string;
lab(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
}): string;
/**
* Returns a LAB (CIELAB) color.
*
Expand All @@ -583,7 +722,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lab(options?: { format?: NumberColorFormat }): number[];
lab(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
}): number[];
/**
* Returns a LAB (CIELAB) color.
*
Expand All @@ -598,7 +744,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lab(options?: { format?: ColorFormat }): string | number[];
lab(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
}): string | number[];
lab(options?: { format?: ColorFormat }): string | number[] {
const lab = [this.faker.number.float({ precision: 0.000001 })];
for (let i = 0; i < 2; i++) {
Expand Down Expand Up @@ -638,7 +791,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lch(options?: { format?: StringColorFormat }): string;
lch(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
}): string;
/**
* Returns an LCH color. Even though upper bound of
* chroma in LCH color space is theoretically unbounded,
Expand All @@ -654,7 +814,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lch(options?: { format?: NumberColorFormat }): number[];
lch(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
}): number[];
/**
* Returns an LCH color. Even though upper bound of
* chroma in LCH color space is theoretically unbounded,
Expand All @@ -672,7 +839,14 @@ export class ColorModule {
*
* @since 7.0.0
*/
lch(options?: { format?: ColorFormat }): string | number[];
lch(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
}): string | number[];
lch(options?: { format?: ColorFormat }): string | number[] {
const lch = [this.faker.number.float({ precision: 0.000001 })];
for (let i = 0; i < 2; i++) {
Expand Down Expand Up @@ -706,7 +880,17 @@ export class ColorModule {
* @since 7.0.0
*/
colorByCSSColorSpace(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: StringColorFormat;
/**
* Color space to generate the color for.
*
* @default 'sRGB'
*/
space?: CSSSpace;
}): string;
/**
Expand All @@ -723,7 +907,17 @@ export class ColorModule {
* @since 7.0.0
*/
colorByCSSColorSpace(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: NumberColorFormat;
/**
* Color space to generate the color for.
*
* @default 'sRGB'
*/
space?: CSSSpace;
}): number[];
/**
Expand All @@ -742,7 +936,17 @@ export class ColorModule {
* @since 7.0.0
*/
colorByCSSColorSpace(options?: {
/**
* Format of generated RGB color.
*
* @default 'decimal'
*/
format?: ColorFormat;
/**
* Color space to generate the color for.
*
* @default 'sRGB'
*/
space?: CSSSpace;
}): string | number[];
colorByCSSColorSpace(options?: {
Expand Down
Loading