import React, { useState } from "react"; import { Modal } from "./Modal"; import Button from "@mui/material/Button"; import Typography from "@mui/material/Typography"; import TextField from "@mui/material/TextField"; import DoneIcon from "@mui/icons-material/Done"; import IconButton from "@mui/material/IconButton"; import ReplyIcon from "@mui/icons-material/Reply"; import { Color, ColorPicker } from "material-ui-color"; import { ThemeEvents } from "./Theme"; import { Settings, defaultSettings } from "../../Settings/Settings"; interface IProps { open: boolean; onClose: () => void; } function ColorEditor({ name }: { name: string }): React.ReactElement { const [color, setColor] = useState(Settings.theme[name]); if (color === undefined) return <>; const valid = color.match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/g); function set(): void { if (!valid) return; Settings.theme[name] = color; ThemeEvents.emit(); } function revert(): void { Settings.theme[name] = defaultSettings.theme[name]; setColor(defaultSettings.theme[name]); ThemeEvents.emit(); } function onChange(event: React.ChangeEvent): void { setColor(event.target.value); } function onColorPickerChange(newValue: Color): void { setColor("#" + newValue.hex.toLowerCase()); } return ( <> ), endAdornment: ( <> ), }} /> ); } export function ThemeEditorModal(props: IProps): React.ReactElement { return ( primary secondary warning info error






); }