@m13v/seo-components 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/Particles.tsx +11 -4
package/package.json
CHANGED
|
@@ -68,8 +68,9 @@ interface ParticlesProps {
|
|
|
68
68
|
ease?: number;
|
|
69
69
|
size?: number;
|
|
70
70
|
refresh?: boolean;
|
|
71
|
-
/** Hex color for particles. Pass your brand accent color.
|
|
72
|
-
*
|
|
71
|
+
/** Hex color for particles. Pass your brand accent color. If omitted,
|
|
72
|
+
* reads the consumer's `--seo-accent` CSS variable at mount (falling
|
|
73
|
+
* back to teal #14b8a6). Only hex values are supported (canvas context). */
|
|
73
74
|
color?: string;
|
|
74
75
|
vx?: number;
|
|
75
76
|
vy?: number;
|
|
@@ -95,7 +96,7 @@ export function Particles({
|
|
|
95
96
|
ease = 50,
|
|
96
97
|
size = 0.4,
|
|
97
98
|
refresh = false,
|
|
98
|
-
color
|
|
99
|
+
color,
|
|
99
100
|
vx = 0,
|
|
100
101
|
vy = 0,
|
|
101
102
|
}: ParticlesProps) {
|
|
@@ -108,7 +109,13 @@ export function Particles({
|
|
|
108
109
|
const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });
|
|
109
110
|
const dpr = typeof window !== "undefined" ? window.devicePixelRatio : 1;
|
|
110
111
|
|
|
111
|
-
const
|
|
112
|
+
const [resolvedColor, setResolvedColor] = useState<string>(
|
|
113
|
+
color ?? "#14b8a6",
|
|
114
|
+
);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
setResolvedColor(color ?? resolveAccentFromDOM());
|
|
117
|
+
}, [color]);
|
|
118
|
+
const rgb = hexToRgb(resolvedColor);
|
|
112
119
|
|
|
113
120
|
const circleParams = (): Circle => {
|
|
114
121
|
const x = Math.floor(Math.random() * canvasSize.current.w);
|