Formatting tweak

This commit is contained in:
Bradlee Speice 2024-12-11 17:31:34 -05:00
parent f643996128
commit 192286a86a

View File

@ -1,6 +1,5 @@
import React, {useEffect, useState, createContext, useRef} from "react";
import {useColorMode} from "@docusaurus/theme-common";
import BrowserOnly from "@docusaurus/BrowserOnly";
type PainterProps = {
width: number;
@ -76,13 +75,18 @@ export const Canvas: React.FC<CanvasProps> = ({style, children}) => {
}
}, [painter]);
const filter = useColorMode().colorMode === 'dark' ? 'invert(1)' : '';
const canvasProps = {
ref: canvasRef,
width,
height,
style: {filter: useColorMode().colorMode === 'dark' ? 'invert(1)' : ''}
}
return (
<>
<center>
<div ref={sizingRef} style={style}>
{width > 0 ? <canvas ref={canvasRef} width={width} height={height} style={{filter}}/> : null}
{width > 0 ? <canvas {...canvasProps}/> : null}
</div>
</center>
<PainterContext.Provider value={{width, height, setPainter}}>