"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { cn } from "@/lib/utils" export function AdaptiveButtonsSection() { const [buttonColor, setButtonColor] = useState("#FF8C38") // Default primary color // Sample button colors to demonstrate contrast const sampleColors = [ { name: "Primary", color: "var(--primary)", textClass: "text-primary-foreground" }, { name: "Light Gray", color: "#E5E5E5", textClass: "text-gray-900" }, { name: "Dark Gray", color: "#333333", textClass: "text-white" }, { name: "Red", color: "#E53E3E", textClass: "text-white" }, { name: "Green", color: "#38A169", textClass: "text-white" }, { name: "Blue", color: "#3182CE", textClass: "text-white" }, { name: "Yellow", color: "#ECC94B", textClass: "text-gray-900" }, { name: "Pink", color: "#D53F8C", textClass: "text-white" }, { name: "Purple", color: "#805AD5", textClass: "text-white" }, ] return (

Adaptive Button Text

Custom Color Button

setButtonColor(e.target.value)} className="w-20 h-10 p-1" /> setButtonColor(e.target.value)} className="w-32" />

The text color automatically adjusts based on the background color to maintain readability.

Color Examples

{sampleColors.map((sample) => ( ))}

Accessibility Note

Buttons automatically adjust their text color to maintain a contrast ratio of at least 4.5:1, meeting WCAG AA accessibility standards. This ensures text remains readable regardless of the button's background color.

) }