Skip to content

docs(color): fix color rgb docs #1958

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

Merged
merged 4 commits into from
Mar 23, 2023
Merged
Changes from 2 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
60 changes: 30 additions & 30 deletions src/modules/color/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class ColorModule {
* Returns an RGB color.
*
* @example
* faker.color.rgb() // '0xffffFF'
* faker.color.rgb() // '#8be4ab'
*
* @since 7.0.0
*/
Expand All @@ -240,34 +240,34 @@ export class ColorModule {
* 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.prefix Prefix of the generated hex color. Only applied when 'hex' format is used. Defaults to `'#'`.
* @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'lower'`.
* @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: 'css' }) // 'rgb(255, 0, 0)'
* faker.color.rgb({ format: 'binary' }) // '10000000 00000000 11111111'
* faker.color.rgb() // '#8be4ab'
* faker.color.rgb({ prefix: '0x' }) // '0x9ddc8b'
* faker.color.rgb({ casing: 'upper' }) // '#B8A51E'
* faker.color.rgb({ casing: 'lower' }) // '#b12f8b'
* faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#eb0c16'
* faker.color.rgb({ format: 'hex', casing: 'lower' }) // '#bb9d17'
* faker.color.rgb({ format: 'css' }) // 'rgb(216, 17, 192)'
* faker.color.rgb({ format: 'binary' }) // '00110010 00001000 01110110'
*
* @since 7.0.0
*/
rgb(options?: {
/**
* Prefix of the generated hex color. Only applied when 'hex' format is used.
*
* @default '0x'
* @default '#'
*/
prefix?: string;
/**
* Letter type case of the generated hex color. Only applied when `'hex'` format is used.
*
* @default 'mixed'
* @default 'lower'
*/
casing?: Casing;
/**
Expand All @@ -291,9 +291,9 @@ export class ColorModule {
* @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`.
*
* @example
* faker.color.rgb() // '0xffffFF'
* faker.color.rgb({ format: 'decimal' }) // [255, 255, 255]
* faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [255, 255, 255, 0.4]
* faker.color.rgb() // '0x8be4ab'
* faker.color.rgb({ format: 'decimal' }) // [64, 192,174]
* faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [52, 250, 209, 0.21]
*
* @since 7.0.0
*/
Expand All @@ -315,36 +315,36 @@ export class ColorModule {
* 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.prefix Prefix of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'#'`.
* @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'lower'`.
* @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]
* faker.color.rgb() // '#0d7f26'
* faker.color.rgb({ prefix: '0x' }) // '0x9ddc8b'
* faker.color.rgb({ casing: 'upper' }) // '#B8A51E'
* faker.color.rgb({ casing: 'lower' }) // '#b12f8b'
* faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#eb0c16'
* faker.color.rgb({ format: 'hex', casing: 'lower' }) // '#bb9d17'
* faker.color.rgb({ format: 'decimal' }) // [64, 192,174]
* faker.color.rgb({ format: 'css' }) // 'rgb(216, 17, 192)'
* faker.color.rgb({ format: 'binary' }) // '00110010 00001000 01110110'
* faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [52, 250, 209, 0.21]
*
* @since 7.0.0
*/
rgb(options?: {
/**
* Prefix of the generated hex color. Only applied when `'hex'` format is used.
*
* @default '0x'
* @default '#'
*/
prefix?: string;
/**
* Letter type case of the generated hex color. Only applied when `'hex'` format is used.
*
* @default 'mixed'
* @default 'lower'
*/
casing?: Casing;
/**
Expand Down