excalidraw/excalidraw

Improve Feedback: Display Error Message for Invalid Hexadecimal Color Codes

Open

#9527 opened on May 14, 2025

View on GitHub
 (7 comments) (3 reactions) (0 assignees)TypeScript (123,243 stars) (13,649 forks)batch import
UX/UIenhancementgood first issue

Description

Description

Currently, Excalidraw accepts some invalid or malformed hexadecimal color values in the color input field without providing any visual or textual feedback to the user. This may cause confusion as users may not realize why the color hasn’t changed.

Steps to Reproduce

  1. Open Excalidraw.
  2. Select the pencil tool (or any tool that allows color selection).
  3. Open the custom color input field (hex code).
  4. Enter the following invalid values one at a time:
  • 123456789 → more than 8 characters
  • 1 → only 1 digit
  • 12 → only 2 digits
  • 12345 → 5 digits
  • 1234567 → 7 digits
  • zzzzzz → contains invalid hexadecimal characters
  • blue → non-hex text input

Expected Behavior

A clear and visible error message should appear when an invalid hexadecimal value is entered, such as:

  • Error: Hex code must be 3, 4, 6, or 8 characters (excluding #)
  • Error: Invalid characters in hex code
  • Error: Not a valid hex color

Actual Behavior

The input is ignored silently and the pencil color remains unchanged. No error or feedback is shown to the user.

Why This Matters

  • Improves usability by helping users understand why their input didn’t work.
  • Prevents frustration or confusion when using custom colors.
  • Follows good UX practices for input validation and error feedback.

Suggested Fix

Implement front-end validation in the color input field and display an error tooltip or inline message when an invalid value is detected.

Contributor guide