diff --git a/packages/twenty-shared/src/application/utils/getDefaultColorForCustomObject.util.ts b/packages/twenty-shared/src/application/utils/getDefaultColorForCustomObject.util.ts index 6794eefd4fd..a5dce364b38 100644 --- a/packages/twenty-shared/src/application/utils/getDefaultColorForCustomObject.util.ts +++ b/packages/twenty-shared/src/application/utils/getDefaultColorForCustomObject.util.ts @@ -1,8 +1,11 @@ -import { MAIN_COLOR_NAMES } from '../../constants/MainColorNames'; +import { + MAIN_COLOR_NAMES, + type ThemeColorName, +} from '../../constants/MainColorNames'; export const getDefaultColorForCustomObject = ( nameSingular: string, -): string => { +): ThemeColorName => { const customObjectColors = MAIN_COLOR_NAMES.filter( (color): color is Exclude<(typeof MAIN_COLOR_NAMES)[number], 'gray'> => color !== 'gray', diff --git a/packages/twenty-shared/src/constants/MainColorNames.ts b/packages/twenty-shared/src/constants/MainColorNames.ts index 097aa482c55..c5186b4e2f7 100644 --- a/packages/twenty-shared/src/constants/MainColorNames.ts +++ b/packages/twenty-shared/src/constants/MainColorNames.ts @@ -25,3 +25,5 @@ export const MAIN_COLOR_NAMES = [ 'brown', 'gray', ] as const; + +export type ThemeColorName = (typeof MAIN_COLOR_NAMES)[number]; diff --git a/packages/twenty-shared/src/constants/index.ts b/packages/twenty-shared/src/constants/index.ts index 0a76565ae71..8ccb7a88ee6 100644 --- a/packages/twenty-shared/src/constants/index.ts +++ b/packages/twenty-shared/src/constants/index.ts @@ -29,6 +29,7 @@ export { FILES_FIELD_MAX_NUMBER_OF_VALUES } from './FilesFieldMaxNumberOfValues' export { GROUP_BY_DATE_GRANULARITY_THAT_REQUIRE_TIME_ZONE } from './GroupByDateGranularityThatRequireTimeZone'; export { IANA_TIME_ZONES } from './IanaTimeZones'; export { LABEL_IDENTIFIER_FIELD_METADATA_TYPES } from './LabelIdentifierFieldMetadataTypes'; +export type { ThemeColorName } from './MainColorNames'; export { MAIN_COLOR_NAMES } from './MainColorNames'; export { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from './MultiItemFieldDefaultMaxValues'; export { MULTI_ITEM_FIELD_MIN_MAX_VALUES } from './MultiItemFieldMinMaxValues'; diff --git a/packages/twenty-ui/src/theme/constants/MainColorNames.ts b/packages/twenty-ui/src/theme/constants/MainColorNames.ts index 36b4d812cb2..2a3597d55f7 100644 --- a/packages/twenty-ui/src/theme/constants/MainColorNames.ts +++ b/packages/twenty-ui/src/theme/constants/MainColorNames.ts @@ -1,5 +1,5 @@ -import { MAIN_COLORS_LIGHT } from './MainColorsLight'; +import { MAIN_COLOR_NAMES, type ThemeColorName } from 'twenty-shared/constants'; -export const MAIN_COLOR_NAMES = Object.keys(MAIN_COLORS_LIGHT) as ThemeColor[]; +export { MAIN_COLOR_NAMES }; -export type ThemeColor = keyof typeof MAIN_COLORS_LIGHT; +export type ThemeColor = ThemeColorName; diff --git a/packages/twenty-ui/src/theme/constants/MainColorsLight.ts b/packages/twenty-ui/src/theme/constants/MainColorsLight.ts index 4a00386d134..df49e9ab70f 100644 --- a/packages/twenty-ui/src/theme/constants/MainColorsLight.ts +++ b/packages/twenty-ui/src/theme/constants/MainColorsLight.ts @@ -1,7 +1,8 @@ import * as RadixColors from '@radix-ui/colors'; +import type { ThemeColorName } from 'twenty-shared/constants'; import { GRAY_SCALE_LIGHT } from './GrayScaleLight'; -export const MAIN_COLORS_LIGHT = { +export const MAIN_COLORS_LIGHT: Record = { // Reds red: RadixColors.redP3.red9, ruby: RadixColors.rubyP3.ruby9,