@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 24 lines 820 Bytes
Raw
1 import { useAtomValue } from "@effect/atom-react";
2
3 import { subscribeAtomChanges } from "../rpc/atomRegistry";
4 import {
5 environmentThemeDefinitionsAtom,
6 storePublishedEnvironmentThemes,
7 type ThemeDefinition,
8 } from "../themePalette";
9 import { refreshTheme } from "./useTheme";
10
11 export function useEnvironmentThemeDefinitions(): ReadonlyArray<ThemeDefinition> {
12 return useAtomValue(environmentThemeDefinitionsAtom);
13 }
14
15 /**
16 * The palette is painted from a snapshot taken when the theme last changed, so new colors
17 * only land if the active theme is re-applied.
18 */
19 export function startEnvironmentThemeRepaint(): () => void {
20 return subscribeAtomChanges(environmentThemeDefinitionsAtom, (definitions) => {
21 storePublishedEnvironmentThemes(definitions);
22 refreshTheme({ preservePreview: true });
23 });
24 }