import React, { useContext, useState } from "react"; import { AutoSizingSvg } from "../auto-sizing-svg"; import { CreatureContext, CreatureContextType } from "../creature-symbol"; import { createCreatureSymbolFactory } from "../creature-symbol-factory"; import { HoverDebugHelper } from "../hover-debug-helper"; import { Page } from "../page"; import { PaletteAlgorithmWidget } from "../palette-algorithm-widget"; import { Random } from "../random"; import { createRandomColorPalette, DEFAULT_RANDOM_PALETTE_ALGORITHM, RandomPaletteAlgorithm, } from "../random-colors"; import { createSvgSymbolContext } from "../svg-symbol"; import { svgScale, SvgTransform } from "../svg-transform"; import { SvgVocabulary } from "../svg-vocabulary"; import { SymbolContextWidget } from "../symbol-context-widget"; import { range } from "../util"; const symbol = createCreatureSymbolFactory(SvgVocabulary); const Eye = symbol("eye"); const Hand = symbol("hand"); const Arm = symbol("arm"); const Antler = symbol("antler"); const Crown = symbol("crown"); const Wing = symbol("wing"); const MuscleArm = symbol("muscle_arm"); const Leg = symbol("leg"); const Tail = symbol("tail"); const Lightning = symbol("lightning"); const EYE_CREATURE = ( ); const RandomColorSampling: React.FC<{}> = () => { const [paletteAlg, setPaletteAlg] = useState( DEFAULT_RANDOM_PALETTE_ALGORITHM ); const [seed, setSeed] = useState(Date.now()); const NUM_COLORS = 100; const rng = new Random(seed); const palette = createRandomColorPalette(NUM_COLORS, rng, paletteAlg); return ( <>
{range(NUM_COLORS).map((i) => (
))}
); }; export const DebugPage: React.FC<{}> = () => { const [symbolCtx, setSymbolCtx] = useState(createSvgSymbolContext()); const defaultCtx = useContext(CreatureContext); const ctx: CreatureContextType = { ...defaultCtx, ...symbolCtx, fill: symbolCtx.showSpecs ? "none" : symbolCtx.fill, }; return (

Random color sampling

{EYE_CREATURE}
); };