diff --git a/lib/pages/debug-page.tsx b/lib/pages/debug-page.tsx index 8fb8301..2457e27 100644 --- a/lib/pages/debug-page.tsx +++ b/lib/pages/debug-page.tsx @@ -4,10 +4,13 @@ import { CreatureContext, CreatureContextType } from "../creature-symbol"; import { createCreatureSymbolFactory } from "../creature-symbol-factory"; import { HoverDebugHelper } from "../hover-debug-helper"; import { Page } from "../page"; +import { Random } from "../random"; +import { createRandomColorPalette } 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); @@ -51,6 +54,35 @@ const EYE_CREATURE = ( ); +const RandomColorSampling: React.FC<{}> = () => { + const [seed, setSeed] = useState(Date.now()); + const NUM_COLORS = 100; + const rng = new Random(seed); + const palette = createRandomColorPalette(NUM_COLORS, rng); + + return ( + <> +
+
+ {range(NUM_COLORS).map((i) => ( +
+ ))} +
+
+
+ +
+ + ); +}; + export const DebugPage: React.FC<{}> = () => { const [symbolCtx, setSymbolCtx] = useState(createSvgSymbolContext()); const defaultCtx = useContext(CreatureContext); @@ -64,6 +96,8 @@ export const DebugPage: React.FC<{}> = () => {
+

Random color sampling

+