@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/seo-components",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "bump:consumers": "bash scripts/bump-consumers.sh",
@@ -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. Defaults to teal (#14b8a6).
72
- * CSS custom properties are not supported here (canvas context). */
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 = "#14b8a6",
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 rgb = hexToRgb(color);
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);