Skip to content

Commit

Permalink
Add buttons to switch between dark/light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhanshuguptagit authored and neenaoffline committed Nov 13, 2023
1 parent 03bebd4 commit 2121420
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bean/ui/scratch.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
:evaluated)))
:scratch)}
[:div {:class "scratch-header bean-label"}
[:button {:on-click (fn [_]
[:button {:class [:scratch-header-btn]
:on-click (fn [_]
(swap! sheet #(-> %
scratch/reevaluate
set-eval-state)))}
""]
[:button {:class [:scratch-header-btn :dark-mode-btn]
:on-click #(.setAttribute js/document.documentElement "data-theme" "dark")}
""]
[:button {:class [:scratch-header-btn :light-mode-btn]
:on-click #(.setAttribute js/document.documentElement "data-theme" "light")}
""]
[:div {:class :scratch-error} (:code-error @sheet)]]
[:div {:class :scratch-thick-lines}]
[:div {:class :scratch-body}
Expand Down

0 comments on commit 2121420

Please sign in to comment.