summaryrefslogtreecommitdiff
path: root/pages/_app.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-28 16:48:10 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-28 16:48:10 +0200
commit173963d752bc8ea9c18d4165c0bcf88097c69cbe (patch)
treefba23285ef87ee4af35a88bb554ff4580e3744c4 /pages/_app.tsx
parent8b9d53389fe346259f4288f341abc2df5d5679aa (diff)
changed theme sync to websockets
Diffstat (limited to 'pages/_app.tsx')
-rw-r--r--pages/_app.tsx43
1 files changed, 23 insertions, 20 deletions
diff --git a/pages/_app.tsx b/pages/_app.tsx
index aa0e428..410b333 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -32,28 +32,31 @@ function MyApp({ Component, pageProps }: AppProps) {
yellow: '#FCCE7B',
}
const [emacsTheme, setEmacsTheme] = useState<typeof initialTheme>(initialTheme)
- useEffect(() => {
- const trackTheme = new EventSource('http://127.0.0.1:35901/theme')
- trackTheme.addEventListener('message', (e) => {
- const themeData = JSON.parse(e.data)
- if (!themeData.base4) {
- const bgfgInterpolate = d3int.interpolate(emacsTheme.bg, emacsTheme.fg)
- themeData.base1 = bgfgInterpolate(0.1)
- themeData.base2 = bgfgInterpolate(0.2)
- themeData.base3 = bgfgInterpolate(0.3)
- themeData.base4 = bgfgInterpolate(0.4)
- themeData.base5 = bgfgInterpolate(0.5)
- themeData.base6 = bgfgInterpolate(0.6)
- themeData.base7 = bgfgInterpolate(0.7)
- themeData.base8 = bgfgInterpolate(0.8)
- }
- setEmacsTheme(themeData)
- })
- }, [])
-
+ /* useEffect(() => {
+ * const trackTheme = new EventSource('http://127.0.0.1:35901/theme')
+ * trackTheme.addEventListener('message', (e) => {
+ * const themeData = JSON.parse(e.data)
+ * console.log("aa")
+ * if (!themeData.base4) {
+ * const bgfgInterpolate = d3int.interpolate(emacsTheme.bg, emacsTheme.fg)
+ * themeData.base1 = bgfgInterpolate(0.1)
+ * themeData.base2 = bgfgInterpolate(0.2)
+ * themeData.base3 = bgfgInterpolate(0.3)
+ * themeData.base4 = bgfgInterpolate(0.4)
+ * themeData.base5 = bgfgInterpolate(0.5)
+ * themeData.base6 = bgfgInterpolate(0.6)
+ * themeData.base7 = bgfgInterpolate(0.7)
+ * themeData.base8 = bgfgInterpolate(0.8)
+ * console.log('o o')
+ * }
+ * emacsTheme.bg !== themeData.bg && setEmacsTheme(themeData)
+ * })
+ * }, [])
+ */
const borderColor = emacsTheme.violet + 'aa'
const missingColor = d3int.interpolate(emacsTheme.base1, emacsTheme.base2)(0.2)
const theme = useMemo(() => {
+ console.log('ii')
return {
colors: {
white: emacsTheme.bg,
@@ -124,7 +127,7 @@ function MyApp({ Component, pageProps }: AppProps) {
const extendedTheme = extendTheme(theme)
return (
<ChakraProvider theme={extendedTheme}>
- <Component {...pageProps} />
+ <Component {...pageProps} setEmacsTheme={setEmacsTheme} />
</ChakraProvider>
)
}