Skip to content

Commit 9eb65e1

Browse files
feat: add possibility to pass global color
1 parent b947786 commit 9eb65e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/HudProvider.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export type IconProps = { color?: unknown; name: string; size?: number };
3939
export type HudOptions = {
4040
backgroundColor?: string;
4141
borderRadius?: number;
42+
color?: string;
4243
fadeDuration?: number;
4344
height?: number;
4445
rotate?: boolean;
@@ -74,6 +75,7 @@ export const HudProvider = <P extends IconProps>({
7475
backgroundColor = 'rgba(0,0,0,0.8)',
7576
borderRadius = 5,
7677
children,
78+
color = 'white',
7779
containerStyles,
7880
fadeDuration = 700,
7981
height = 80,
@@ -92,20 +94,22 @@ export const HudProvider = <P extends IconProps>({
9294
() => ({
9395
backgroundColor,
9496
borderRadius,
97+
color,
9598
fadeDuration,
9699
height,
97100
rotate,
98101
rotateDuration,
99102
width,
100103
}),
101104
[
102-
fadeDuration,
103105
backgroundColor,
104106
borderRadius,
107+
color,
108+
fadeDuration,
105109
height,
106-
width,
107110
rotate,
108111
rotateDuration,
112+
width,
109113
]
110114
);
111115

@@ -165,7 +169,7 @@ export const HudProvider = <P extends IconProps>({
165169
}
166170

167171
setIconProps({
168-
color: 'white',
172+
color: defaultOptions.color,
169173
size: Math.min(nextOptions.width, nextOptions.height) * 0.5,
170174
...nextIconProps,
171175
});

0 commit comments

Comments
 (0)