Skip to content

Commit

Permalink
separate :danger color, separate duplicated :landed theme
Browse files Browse the repository at this point in the history
  • Loading branch information
erikseppanen committed Oct 3, 2022
1 parent fa0d1f3 commit 12f4a9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/quo2/components/messages/system_message.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
[quo2.components.avatars.user-avatar :as user-avatar]
[quo2.components.avatars.icon-avatar :as icon-avatar]))

(def themes-landed {:pinned colors/primary-50-opa-5
:added colors/primary-50-opa-5
:deleted colors/danger-50-opa-5})

(def themes
{:light {:text colors/neutral-100
:time colors/neutral-50
:bg {:default colors/white
:pressed colors/neutral-5
:landed {:pinned colors/primary-50-opa-5
:added colors/primary-50-opa-5
:deleted colors/danger-50-opa-5}}}
:landed themes-landed}}
:dark {:text colors/white
:time colors/neutral-40
:bg {:default colors/neutral-90
:pressed colors/neutral-80
:landed {:pinned colors/primary-50-opa-5
:added colors/primary-50-opa-5
:deleted colors/danger-50-opa-5}}}})
:landed themes-landed}}})

(defn get-color [& keys]
(reduce (fn [acc k] (get acc k (reduced acc)))
Expand Down
10 changes: 7 additions & 3 deletions src/quo2/foundations/colors.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@
(def customization
{:primary {50 primary-50 ;; User can also use primary color as customisation color
60 primary-60}
:danger {50 danger-50
60 danger-60}
:purple {50 "#8661C1"
60 "#5E478C"}
:indigo {50 "#496289"
Expand All @@ -147,6 +145,12 @@
:beige {50 "#CAAE93"
60 "#AA927C"}})

;; Colors for customizing profiles and communities themes
(def colors-map (merge {:danger {50 danger-50
60 danger-60}
:success {50 success-50
60 success-60}} customization))

(def custom-color
"(custom-color color suffix opacity)
color :primary/:purple/...
Expand All @@ -157,7 +161,7 @@
([color suffix]
(custom-color color suffix nil))
([color suffix opacity]
(let [base-color (get-in customization [(keyword color) suffix])]
(let [base-color (get-in colors-map [(keyword color) suffix])]
(if opacity (alpha base-color (/ opacity 100)) base-color))))))

(defn custom-color-by-theme
Expand Down

0 comments on commit 12f4a9a

Please sign in to comment.