mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
Add color validator.
This commit is contained in:
parent
f82f9f8384
commit
2323e8f1c7
@ -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…
x
Reference in New Issue
Block a user