mirror of
https://github.com/penpot/penpot.git
synced 2025-06-25 18:37:00 +02:00
🔥 Remove old code for theme support (#6597)
This commit is contained in:
parent
ad26efaa5d
commit
c9ceceb7e9
2 changed files with 1 additions and 39 deletions
|
@ -93,7 +93,6 @@
|
|||
[]
|
||||
(mw/init!)
|
||||
(i18n/init! cf/translations)
|
||||
(theme/init! cf/themes)
|
||||
(cur/init-styles)
|
||||
(thr/init!)
|
||||
(init-ui)
|
||||
|
|
|
@ -3,53 +3,16 @@
|
|||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
;; Copyright (c) Mathieu BRUNOT <mathieu.brunot@monogramm.io>
|
||||
|
||||
(ns app.util.theme
|
||||
"A theme manager."
|
||||
(:require
|
||||
[app.config :as cfg]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.storage :as storage]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defonce theme (get storage/global ::theme cfg/default-theme))
|
||||
(defonce theme-sub (rx/subject))
|
||||
(defonce themes #js {})
|
||||
|
||||
(defn init!
|
||||
[data]
|
||||
(set! themes data))
|
||||
|
||||
(defn set-current-theme!
|
||||
[v]
|
||||
(when (not= theme v)
|
||||
(when-some [el (dom/get-element "theme")]
|
||||
(set! (.-href el) (str "css/main-" v ".css")))
|
||||
(swap! storage/global assoc ::theme v)
|
||||
(set! theme v)
|
||||
(rx/push! theme-sub v)))
|
||||
|
||||
(defn set-default-theme!
|
||||
[]
|
||||
(set-current-theme! cfg/default-theme))
|
||||
|
||||
(defn use-theme
|
||||
[]
|
||||
(let [[theme set-theme] (mf/useState theme)]
|
||||
(mf/useEffect (fn []
|
||||
(let [sub (rx/sub! theme-sub #(set-theme %))]
|
||||
#(rx/dispose! sub)))
|
||||
#js [])
|
||||
theme))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Set the preferred color scheme based on the user's system settings.
|
||||
;; TODO: this is unrelated to the theme support above, which seems unused as
|
||||
;; of v2.7
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defonce ^:private color-scheme-mq
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue