Skip to content

Commit

Permalink
Use edraw-color-syntax in edraw-web-color Widget
Browse files Browse the repository at this point in the history
Support modern CSS color syntax.
  • Loading branch information
misohena committed Feb 16, 2025
1 parent c917403 commit beb330e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion edraw-color.el
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,10 @@ is assumed to be specified."
"\\(?:\\(?:[ \t\n\r\f]*\\(?:"
(edraw-color-syntax-regexp syntax-system)
"\\)"
trailing-regexp
(pcase trailing-regexp
('eos "\\'")
('ws-eos "[ \t\n\r\f]*\\'")
((pred stringp) trailing-regexp))
"\\)\\|\\)")
string position)
(< (match-beginning 0) (match-end 0)))
Expand Down
6 changes: 3 additions & 3 deletions edraw-widget.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@

(defun edraw-widget-web-color-sample-face-get (widget)
(let ((color (condition-case nil
(edraw-color-from-string (widget-value widget))
(car (edraw-color-info-from-string (widget-value widget)
nil 'css 'ws-eos))
(error (widget-get widget :value)))))
(if color
;;@todo Use SVG image for sample
Expand All @@ -102,8 +103,7 @@
(and (stringp value)
(or (string= value "")
(string= value "none")
(assoc value edraw-color-css-color-names)
(string-match edraw-color-string-patterns-re value))))
(edraw-color-info-from-string value nil 'css 'ws-eos))))

(defun edraw-widget-web-color-validate (widget)
"Check that WIDGET's value is a valid color."
Expand Down

0 comments on commit beb330e

Please sign in to comment.