Skip to content

Commit

Permalink
[docs] Cleanup custom colors declaration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Oct 2, 2022
1 parent 914ae01 commit aa3b261
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions docs/src/docs/theming/colors.mdx
Expand Up @@ -124,20 +124,9 @@ separated with `.`, for example `pink.3`:

## Add custom colors types

TypeScript will only autocomplete Mantine's default colors when accessing the theme. To add your custom colors to the MantineColor type, you can use TypeScript module declaration:
TypeScript will only autocomplete Mantine's default colors when accessing the theme. To add your custom colors to the MantineColor type, you can use TypeScript module declaration.

```ts
import { Tuple } from '@mantine/core';

type CustomColors = 'primaryColorName' | 'secondaryColorName';

declare module '@mantine/core' {
export interface MantineThemeColorsOverride {
colors: Record<CustomColors, Tuple<string, 10>>;
}
}

// or if you want to "extend" standard colors
import { Tuple, DefaultMantineColor } from '@mantine/core';

type ExtendedCustomColors = 'primaryColorName' | 'secondaryColorName' | DefaultMantineColor;
Expand Down

0 comments on commit aa3b261

Please sign in to comment.