Pote.Validator.Hex (Pote v3.0.0)

Copy Markdown View Source

Hex color string validation.

Splits out the hex-specific validation from Pote.Validator so that the validator remains a thin façade dispatching to per-format modules.

Not part of the public API — used only by Pote.Validator.

Accepts:

  • RRGGBB (6 hex chars)
  • #RRGGBB (with optional # prefix)

Summary

Functions

Returns the error message for :invalid_hex.

Validates a hex color code (with or without # prefix).

Functions

error_message(atom)

@spec error_message(atom()) :: String.t()

Returns the error message for :invalid_hex.

validate(code)

@spec validate(String.t()) :: :ok | {:error, atom()}

Validates a hex color code (with or without # prefix).