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:
parent
f82f9f8384
commit
2323e8f1c7
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
Loading…
Add table
Reference in a new issue