Skip to content

Commit

Permalink
chore: apply jsdoc suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 22, 2022
1 parent 2516b16 commit b172a94
Showing 1 changed file with 0 additions and 97 deletions.
97 changes: 0 additions & 97 deletions src/modules/color/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,15 @@ export class Color {
* Returns an RGB color.
*
* @param options Options object.
* @param options.prefix Prefix of the generated hex color. Only applied when 'hex' format is used. Defaults to `'0x'`.
* @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'mixed'`.
* @param options.format Format of generated RGB color. Defaults to `'hex'`.
* @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`.
*
* @example
* faker.color.rgb() // '0xffffFF'
* faker.color.rgb({ prefix: '#' }) // '#ffffFF'
* faker.color.rgb({ casing: 'upper' }) // '0xFFFFFF'
* faker.color.rgb({ casing: 'lower' }) // '0xffffff'
* faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#ffffff'
* faker.color.rgb({ format: 'decimal' }) // [255, 255, 255]
* faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [255, 255, 255, 0.4]
*/
rgb(options?: {
prefix?: string;
casing?: Casing;
format?: NumberColorFormat;
includeAlpha?: boolean;
}): number[];
Expand Down Expand Up @@ -289,27 +281,6 @@ export class Color {
format?: 'hex' | ColorFormat;
includeAlpha?: boolean;
}): string | number[];
/**
* Returns an RGB color.
*
* @param options Options object.
* @param options.prefix Prefix of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'0x'`.
* @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'mixed'`.
* @param options.format Format of generated RGB color. Defaults to `'hex'`.
* @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`.
*
* @example
* faker.color.rgb() // '0xffffFF'
* faker.color.rgb({ prefix: '#' }) // '#ffffFF'
* faker.color.rgb({ casing: 'upper' }) // '0xFFFFFF'
* faker.color.rgb({ casing: 'lower' }) // '0xffffff'
* faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#ffffff'
* faker.color.rgb({ format: 'hex', casing: 'lower' }) // '#ffffff'
* faker.color.rgb({ format: 'decimal' }) // [255, 255, 255]
* faker.color.rgb({ format: 'css' }) // 'rgb(255, 0, 0)'
* faker.color.rgb({ format: 'binary' }) // '10000000 00000000 11111111'
* faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [255, 255, 255, 0.4]
*/
rgb(options?: {
prefix?: string;
casing?: Casing;
Expand Down Expand Up @@ -385,18 +356,6 @@ export class Color {
* faker.color.cmyk({ format: 'binary' }) // (8-32 bits) x 4
*/
cmyk(options?: { format?: ColorFormat }): string | number[];
/**
* Returns a CMYK color.
*
* @param options Options object.
* @param options.format Format of generated CMYK color. Defaults to `'decimal'`.
*
* @example
* faker.color.cmyk() // [0.31, 0.52, 0.32, 0.43]
* faker.color.cmyk({ format: 'decimal' }) // [0.31, 0.52, 0.32, 0.43]
* faker.color.cmyk({ format: 'css' }) // cmyk(100%, 0%, 0%, 0%)
* faker.color.cmyk({ format: 'binary' }) // (8-32 bits) x 4
*/
cmyk(options?: { format?: ColorFormat }): string | number[] {
const color: string | number[] = Array.from({ length: 4 }).map(() =>
this.faker.datatype.float({ min: 0, max: 1, precision: 0.01 })
Expand Down Expand Up @@ -462,22 +421,6 @@ export class Color {
format?: ColorFormat;
includeAlpha?: boolean;
}): string | number[];
/**
* Returns an HSL color.
*
* @param options Options object.
* @param options.format Format of generated HSL color. Defaults to `'decimal'`.
* @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`.
*
* @example
* faker.color.hsl() // [201, 0.23, 0.32]
* faker.color.hsl({ format: 'decimal' }) // [300, 0.21, 0.52]
* faker.color.hsl({ format: 'decimal', includeAlpha: true }) // [300, 0.21, 0.52, 0.28]
* faker.color.hsl({ format: 'css' }) // hsl(0deg, 100%, 80%)
* faker.color.hsl({ format: 'css', includeAlpha: true }) // hsl(0deg 100% 50% / 0.5)
* faker.color.hsl({ format: 'binary' }) // (8-32 bits) x 3
* faker.color.hsl({ format: 'binary', includeAlpha: true }) // (8-32 bits) x 4
*/
hsl(options?: {
format?: ColorFormat;
includeAlpha?: boolean;
Expand Down Expand Up @@ -599,18 +542,6 @@ export class Color {
* faker.color.lab({ format: 'binary' }) // (8-32 bits x 3)
*/
lab(options?: { format?: ColorFormat }): string | number[];
/**
* Returns a LAB (CIELAB) color.
*
* @param options Options object.
* @param options.format Format of generated RGB color. Defaults to `'decimal'`.
*
* @example
* faker.color.lab() // [0.832133, -80.3245, 100.1234]
* faker.color.lab({ format: 'decimal' }) // [0.856773, -80.2345, 100.2341]
* faker.color.lab({ format: 'css' }) // lab(29.2345% 39.3825 20.0664)
* faker.color.lab({ format: 'binary' }) // (8-32 bits x 3)
*/
lab(options?: { format?: ColorFormat }): string | number[] {
const lab = [
this.faker.datatype.float({ min: 0, max: 1, precision: 0.000001 }),
Expand Down Expand Up @@ -678,21 +609,6 @@ export class Color {
* faker.color.lch({ format: 'binary' }) // (8-32 bits x 3)
*/
lch(options?: { format?: ColorFormat }): string | number[];
/**
* Returns an LCH color. Even though upper bound of
* chroma in LCH color space is theoretically unbounded,
* it is bounded to 230 as anything above will not
* make a noticeable difference in the browser.
*
* @param options Options object.
* @param options.format Format of generated RGB color. Defaults to `'decimal'`.
*
* @example
* faker.color.lch() // [0.522345, 72.2, 56.2]
* faker.color.lch({ format: 'decimal' }) // [0.522345, 72.2, 56.2]
* faker.color.lch({ format: 'css' }) // lch(52.2345% 72.2 56.2)
* faker.color.lch({ format: 'binary' }) // (8-32 bits x 3)
*/
lch(options?: { format?: ColorFormat }): string | number[] {
const lch = [
this.faker.datatype.float({ min: 0, max: 1, precision: 0.000001 }),
Expand Down Expand Up @@ -760,19 +676,6 @@ export class Color {
format?: ColorFormat;
space?: CSSSpace;
}): string | number[];
/**
* Returns a random color based on CSS color space specified.
*
* @param options Options object.
* @param options.format Format of generated RGB color. Defaults to `'decimal'`.
* @param options.space Color space to generate the color for. Defaults to `'sRGB'`.
*
* @example
* faker.color.colorByCSSColorSpace() // [0.93, 1, 0.82]
* faker.color.colorByCSSColorSpace({ format: 'decimal' }) // [0.12, 0.21, 0.31]
* faker.color.colorByCSSColorSpace({ format: 'css', space: 'display-p3' }) // color(display-p3 0.12 1 0.23)
* faker.color.colorByCSSColorSpace({ format: 'binary' }) // (8-32 bits x 3)
*/
colorByCSSColorSpace(options?: {
format?: ColorFormat;
space?: CSSSpace;
Expand Down

0 comments on commit b172a94

Please sign in to comment.