"use client" import { useId, useState } from "react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { parseHex, runContrastCheck, type OutputLine } from "@/modules/landingPage/lib/tools" import { ToolOutput } from "./tool-output" export function ContrastTool() { const id = useId() const [fg, setFg] = useState("#767676") const [bg, setBg] = useState("#ffffff") const [lines, setLines] = useState(null) // parseHex accepts values without "#" (e.g. "1a1a1a"), but CSS doesn't — // build the preview from the parsed RGB channels instead of the raw input const fgRgb = parseHex(fg) const bgRgb = parseHex(bg) const preview = fgRgb && bgRgb ? { color: `rgb(${fgRgb.join(" ")})`, background: `rgb(${bgRgb.join(" ")})` } : undefined const onSubmit = (event: React.FormEvent) => { event.preventDefault() setLines(runContrastCheck(fg, bg)) } return (

Prüft, ob Text auf einem Hintergrund die WCAG-Kontrastwerte erfüllt, die das BFSG verlangt.

setFg(event.target.value)} spellCheck={false} autoComplete="off" className="font-mono" />
setBg(event.target.value)} spellCheck={false} autoComplete="off" className="font-mono" />
) }