import { useEffect, useState } from "react"; import "../../../../css/bulma.css"; import "./App.css"; import Slider from "./components/Slider"; const COLORS = ["primary", "link", "info", "success", "warning", "danger"]; const KEYS = [ "scheme-h", "primary-h", "primary-s", "primary-l", "link-h", "link-s", "link-l", "info-h", "info-s", "info-l", "success-h", "success-s", "success-l", "warning-h", "warning-s", "warning-l", "danger-h", "danger-s", "danger-l", "skeleton-lines-gap", ]; const UNITS = ["deg", "rem", "em", "%"]; const SUFFIX_TO_KIND = { "-h": "hue", "-s": "saturation", "-l": "lightness", "-gap": "gap", }; function App() { const [vars, setVars] = useState({}); useEffect(() => { const rootStyle = window.getComputedStyle(document.documentElement); const cssvars = {}; KEYS.map((key) => { const original = rootStyle.getPropertyValue(`--bulma-${key}`); const suffix = Object.keys(SUFFIX_TO_KIND).find((kind) => key.endsWith(kind), ); const unit = UNITS.find((unit) => original.endsWith(unit)) || ""; const value = unit !== "" ? original.split(unit)[0] : original; cssvars[key] = { id: key, kind: SUFFIX_TO_KIND[suffix] || "any", original, unit, start: Number(value), }; }); setVars(cssvars); }, []); return (
{COLORS.map((color) => { const h = `${color}-h`; if (!(h in vars)) { return; } const s = `${color}-s`; const l = `${color}-l`; return (
{color}
); })} {/* {vars.map((v) => { const { id, kind, original, unit, start } = v; return (
{id}
); })} */}
); } export default App;