🤖 random colors in ui

Demo Loading...

(defn color [x] (str "oklch(50% 70% " (hash x) ")"))

(def tags ["this" "is" "a" "quick" "demo"])

(defn demo
  []
  [:div {:style {:display "flex"
                 :gap "0.5em"}}
   (for [tag tags]
     [:div {:style {:color (color tag)}}
      "#"
      tag])
   (for [tag tags]
     [:div {:style {:background-color (color tag)
                    :color "white"
                    :padding "0.1em 0.25em"
                    :border-radius "0.25em"}}
      tag])])

(require '[reagent.dom :as rdom])

(rdom/render [demo] (.getElementById js/document "demo"))
2023-11-27
#programming