0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-19 19:21:23 -05:00

Add color validator.

This commit is contained in:
Andrey Antukh 2015-12-24 19:33:53 +02:00
parent f82f9f8384
commit 2323e8f1c7

View file

@ -18,10 +18,18 @@
(v/defvalidator uuid
"Validates maybe-an-int is a valid integer.
For use with validation functions such as `validate` or `valid?`"
{:default-message-format "%s must be a uuid instance"}
{:default-message-format "%s must be a uuid instance"
:optinal true}
[v]
(instance? cljs.core.UUID v))
(v/defvalidator color
"Validates if a string is a valid color."
{:default-message-format "%s must be a valid hex color"
:optional true}
[v]
(not (nil? (re-find #"^#[0-9A-Fa-f]{6}$" v))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;