Skip to content

Commit 28bb0b0

Browse files
Adjusting colors prop
1 parent ecae271 commit 28bb0b0

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

src/plugin/composables/levelColors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ const convertLevelColors: ConvertLevelColors = (options) => {
123123
return;
124124
}
125125

126-
// Top Level and text should always be set to 100% //
127-
if (key === 'text' || level === 0 && (direction === 'asc' as keyof ColorsObject)) {
126+
// Top Level and text color should always be set to 100% //
127+
if (key === 'color' || level === 0 && (direction === 'asc' as keyof ColorsObject)) {
128128
percentage = 100;
129129
}
130130

src/plugin/composables/styles.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import {
1010
// -------------------------------------------------- VDrilldownTable //
1111
export const useTableStyles: UseTableStyles = (options) => {
1212
const { colors, level, theme } = options;
13-
let baseColors: { border?: string; } = {};
13+
let baseColors: { bottomBorder?: string; } = {};
1414

1515
if (typeof colors === 'object' && colors !== null) {
1616
baseColors = useGetLevelColors({
1717
colors,
1818
level,
19-
prop: 'default',
19+
prop: 'table',
2020
themeColors: theme,
2121
});
2222
}
@@ -25,8 +25,8 @@ export const useTableStyles: UseTableStyles = (options) => {
2525
borderBottom: 'none',
2626
};
2727

28-
if (baseColors.border) {
29-
styles.borderBottom = `1px solid ${baseColors.border}`;
28+
if (baseColors.bottomBorder) {
29+
styles.borderBottom = `1px solid ${baseColors.bottomBorder}`;
3030
}
3131

3232
return styles;
@@ -62,8 +62,8 @@ export const useHeaderCellStyles: UseHeaderCellStyles = (options) => {
6262
themeColors: theme,
6363
});
6464

65-
styles.backgroundColor = headerColors.bg;
66-
styles.color = headerColors.text;
65+
styles.backgroundColor = headerColors.background;
66+
styles.color = headerColors.color;
6767

6868
return styles as CSSProperties;
6969
};
@@ -85,8 +85,8 @@ export const useTFootCellStyles: UseTFootCellStyles = (options) => {
8585
});
8686

8787
const styles = {
88-
backgroundColor: baseColors.bg,
89-
color: baseColors.text,
88+
backgroundColor: baseColors.background,
89+
color: baseColors.color,
9090
};
9191

9292
return styles as CSSProperties;

src/plugin/utils/props.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ export const AllProps = {
44
// color: 'primary', // ? Doesn't seem to work
55
colors: () => ({
66
default: {
7+
background: 'primary',
78
base: 'primary',
8-
bg: 'primary',
99
border: 'primary',
10-
text: 'on-primary',
10+
color: 'on-primary',
1111
},
1212
footer: {
13-
bg: '--v-theme-surface',
14-
text: '--v-theme-on-surface',
13+
background: '--v-theme-surface',
14+
color: '--v-theme-on-surface',
1515
},
1616
header: {
17-
bg: 'primary',
18-
text: 'on-primary',
17+
background: 'primary',
18+
color: 'on-primary',
1919
},
2020
percentageChange: 15,
2121
percentageDirection: 'desc',
22+
table: {
23+
bottomBorder: 'primary',
24+
},
2225
}) as const,
2326
columnWidths: () => ([]),
2427
// customFilter: undefined, // ? Needs Testing

src/types/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,32 @@ export interface TableColors<T = any> {
6060
export type ColorsObject = {
6161
default?: {
6262
base?: string;
63-
bg?: string;
63+
background?: string;
6464
border?: string | null;
65-
text?: string;
65+
color?: string;
6666
};
6767
footer?: {
68-
bg?: string;
69-
text?: string;
68+
background?: string;
69+
color?: string;
7070
};
7171
header?: {
72-
bg?: string;
73-
text?: string;
72+
background?: string;
73+
color?: string;
7474
};
7575
percentageChange?: number;
7676
percentageDirection?: 'asc' | 'desc';
77+
table?: {
78+
bottomBorder?: string;
79+
};
7780
};
7881

7982
export type LevelColorResponse = {
83+
background?: string;
8084
base?: string;
81-
bg?: string;
82-
border?: string;
85+
bottomBorder?: string;
8386
circular?: string;
87+
color?: string;
8488
linear?: string;
85-
text?: string;
8689
};
8790

8891
export type HEXColor = string;

0 commit comments

Comments
 (0)