gradio
a09c0e89 - Fix ColorPicker returning inconsistent color formats instead of hex (#13126)

Commit
30 days ago
Fix ColorPicker returning inconsistent color formats instead of hex (#13126) * fix: normalize ColorPicker value to always return hex string The ColorPicker component was returning inconsistent color formats (rgba, rgb, hsl) depending on how the user interacted with the picker, despite documentation stating it should return hex strings. Changes: - Modified hsva_to_rgba() in utils.ts to return hex format via tinycolor instead of raw rgba() strings - Added normalize_color() utility to convert any valid color string to hex format - Applied normalize_color() to text input onChange handler so manually typed colors are also normalized Closes #12071 * Normalize ColorPicker value to hex string format ColorPicker now consistently returns hex color strings instead of various formats like rgba, rgb, or hsl, aligning with documented behavior. * add unit tests --------- Co-authored-by: Freddy Boulton <41651716+freddyaboulton@users.noreply.github.com> Co-authored-by: pngwn <hello@pngwn.io>
Parents
Loading