Skip to content

Commit bee6054

Browse files
feat: color module (#801)
Co-authored-by: Shinigami <chrissi92@hotmail.de>
1 parent bd4d3db commit bee6054

84 files changed

Lines changed: 1500 additions & 58 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.vitepress/api-pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
export const apiPages = [
44
{ text: 'Address', link: '/api/address.html' },
55
{ text: 'Animal', link: '/api/animal.html' },
6+
{ text: 'Color', link: '/api/color.html' },
67
{ text: 'Commerce', link: '/api/commerce.html' },
78
{ text: 'Company', link: '/api/company.html' },
89
{ text: 'Database', link: '/api/database.html' },

scripts/generateLocales.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type DefinitionsType = {
4747
const definitionsTypes: DefinitionsType = {
4848
address: 'AddressDefinitions',
4949
animal: 'AnimalDefinitions',
50+
color: 'ColorDefinitions',
5051
commerce: 'CommerceDefinitions',
5152
company: 'CompanyDefinitions',
5253
database: 'DatabaseDefinitions',

src/definitions/color.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { LocaleEntry } from './definitions';
2+
3+
/**
4+
* The possible definitions related to color.
5+
*/
6+
export type ColorDefinitions = LocaleEntry<{
7+
/**
8+
* Human readable color names
9+
*/
10+
human: string[];
11+
/**
12+
* Color space names.
13+
*/
14+
space: string[];
15+
}>;

src/definitions/commerce.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import type { LocaleEntry } from './definitions';
44
* The possible definitions related to commerce.
55
*/
66
export type CommerceDefinitions = LocaleEntry<{
7-
/**
8-
* Human readable color names
9-
*/
10-
color: string[];
117
/**
128
* Department names inside a shop.
139
*/

src/definitions/definitions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { AddressDefinitions } from './address';
22
import type { AnimalDefinitions } from './animal';
3+
import type { ColorDefinitions } from './color';
34
import type { CommerceDefinitions } from './commerce';
45
import type { CompanyDefinitions } from './company';
56
import type { DatabaseDefinitions } from './database';
@@ -26,6 +27,7 @@ export type LocaleEntry<T> = Partial<T> &
2627
export interface Definitions {
2728
address: AddressDefinitions;
2829
animal: AnimalDefinitions;
30+
color: ColorDefinitions;
2931
commerce: CommerceDefinitions;
3032
company: CompanyDefinitions;
3133
database: DatabaseDefinitions;

src/definitions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export type { AddressDefinitions } from './address';
22
export type { AnimalDefinitions } from './animal';
3+
export type { ColorDefinitions } from './color';
34
export type {
45
CommerceDefinitions,
56
CommerceProductNameDefinitions,

src/faker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FakerError } from './errors/faker-error';
33
import type { KnownLocale } from './locales';
44
import { Address } from './modules/address';
55
import { Animal } from './modules/animal';
6+
import { Color } from './modules/color';
67
import { Commerce } from './modules/commerce';
78
import { Company } from './modules/company';
89
import { Database } from './modules/database';
@@ -60,6 +61,7 @@ export class Faker {
6061

6162
readonly address: Address = new Address(this);
6263
readonly animal: Animal = new Animal(this);
64+
readonly color: Color = new Color(this);
6365
readonly commerce: Commerce = new Commerce(this);
6466
readonly company: Company = new Company(this);
6567
readonly database: Database = new Database(this);

src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import allLocales from './locales';
44
export type {
55
AddressDefinitions,
66
AnimalDefinitions,
7+
ColorDefinitions,
78
CommerceDefinitions,
89
CommerceProductNameDefinitions,
910
CompanyDefinitions,
@@ -27,6 +28,14 @@ export type {
2728
} from './definitions';
2829
export { FakerError } from './errors/faker-error';
2930
export type { FakerOptions, UsableLocale, UsedLocales } from './faker';
31+
export type {
32+
Casing,
33+
ColorFormat,
34+
CSSFunction,
35+
CSSSpace,
36+
NumberColorFormat,
37+
StringColorFormat,
38+
} from './modules/color';
3039
export { Gender } from './modules/name';
3140
export type { GenderType } from './modules/name';
3241
export { Faker };

src/locales/ar/color/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* This file is automatically generated.
3+
* Run 'pnpm run generate:locales' to update.
4+
*/
5+
import type { ColorDefinitions } from '../../..';
6+
import human from './human';
7+
8+
const color: ColorDefinitions = {
9+
human,
10+
};
11+
12+
export default color;

0 commit comments

Comments
 (0)