mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 15:08:27 +02:00
Add stroke colors into recent colors summary.
This commit is contained in:
parent
3fbe465b99
commit
9e72dbb0a0
1 changed files with 8 additions and 4 deletions
|
@ -26,16 +26,20 @@
|
||||||
#(rs/emit! (dw/toggle-tool :workspace/colorpalette)))
|
#(rs/emit! (dw/toggle-tool :workspace/colorpalette)))
|
||||||
|
|
||||||
(defn- count-color
|
(defn- count-color
|
||||||
[state shape]
|
[state shape prop]
|
||||||
(let [color (:fill shape)]
|
(let [color (prop shape)]
|
||||||
(if (contains? state color)
|
(if (contains? state color)
|
||||||
(update state color inc)
|
(update state color inc)
|
||||||
(assoc state color 1))))
|
(assoc state color 1))))
|
||||||
|
|
||||||
(defn- calculate-colors
|
(defn- calculate-colors
|
||||||
[shapes]
|
[shapes]
|
||||||
(let [result (reduce count-color {} shapes)]
|
(as-> (comp
|
||||||
(take 5 (map first (sort-by second (into [] result))))))
|
#(count-color %1 %2 :fill)
|
||||||
|
#(count-color %1 %2 :stroke)) $
|
||||||
|
(reduce $ {} shapes)
|
||||||
|
(sort-by second (into [] $))
|
||||||
|
(take 5 (map first $))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Component
|
;; Component
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue