diff --git a/packages/mantine-react-table/src/column.utils.ts b/packages/mantine-react-table/src/column.utils.ts index c9954024c..cb2a464db 100644 --- a/packages/mantine-react-table/src/column.utils.ts +++ b/packages/mantine-react-table/src/column.utils.ts @@ -15,6 +15,7 @@ import { type MantineTheme, } from '@mantine/core'; import { + type MantineShade, type MRT_Column, type MRT_ColumnDef, type MRT_ColumnOrderState, @@ -390,6 +391,17 @@ export const MRT_DefaultDisplayColumn = { export const parseCSSVarId = (id: string) => id.replace(/[^a-zA-Z0-9]/g, '_'); +export const getPrimaryShade = (theme: MantineTheme): number => + (theme.colorScheme === 'dark' + ? // @ts-ignore + theme.primaryShade?.dark ?? theme.primaryShade + : // @ts-ignore + theme.primaryShade?.light ?? theme.primaryShade) ?? 7; + +export const getPrimaryColor = ( + theme: MantineTheme, + shade?: MantineShade, +): string => theme.colors[theme.primaryColor][shade ?? getPrimaryShade(theme)]; export const flexRender = _flexRender as ( Comp: Renderable, props: any, diff --git a/packages/mantine-react-table/src/columns.utils.module.css b/packages/mantine-react-table/src/columns.utils.module.css index e0ee6d3f0..b3e91a1dc 100644 --- a/packages/mantine-react-table/src/columns.utils.module.css +++ b/packages/mantine-react-table/src/columns.utils.module.css @@ -3,7 +3,7 @@ --width: calc(var(--header-id) * 1px); --bg-color: color-mix(in srgb, var(--mantine-color-dark-7) .2%, var(--mantine-color-black)); background-color: inherit; - // Not very sure about these attribute gymnastics... + /* Not very sure about these attribute gymnastics... */ [data-selected="true"] { background-color: rgba(var(--mantine-primary-color-filled), 0.1); }