@indietabletop/appkit 0.2.3 → 0.3.0

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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sets document background color, reverting it to previous color on unmount.
3
+ */
4
+ export declare function useDocumentBackgroundColor(bodyColor: string): void;
@@ -0,0 +1,14 @@
1
+ import { useEffect } from "react";
2
+ /**
3
+ * Sets document background color, reverting it to previous color on unmount.
4
+ */
5
+ export function useDocumentBackgroundColor(bodyColor) {
6
+ useEffect(() => {
7
+ const style = window.document.documentElement.style;
8
+ const originalColor = style.backgroundColor;
9
+ style.backgroundColor = bodyColor;
10
+ return () => {
11
+ style.backgroundColor = originalColor;
12
+ };
13
+ });
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indietabletop/appkit",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "A collection of modules used in apps built by Indie Tabletop Club",
5
5
  "private": false,
6
6
  "type": "module",