♻️ Create a colors file to save constants of color that can no be refactored into sass variables

This commit is contained in:
eva 2021-11-26 11:48:10 +01:00 committed by Alonso Torres
parent 14b23b491f
commit 7a0c12e073
17 changed files with 61 additions and 30 deletions

View file

@ -6,6 +6,7 @@
(ns app.main.data.workspace.booleans
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.geom.shapes :as gsh]
[app.common.pages :as cp]
@ -35,7 +36,7 @@
head (if (= bool-type :difference) (first shapes) (last shapes))
head (cond-> head
(and (contains? head :svg-attrs) (nil? (:fill-color head)))
(assoc :fill-color "#000000"))
(assoc :fill-color clr/black))
head-data (select-keys head stp/style-properties)]
[(-> {:id (uuid/next)
@ -58,7 +59,7 @@
head (if (= bool-type :difference) (first shapes) (last shapes))
head (cond-> head
(and (contains? head :svg-attrs) (nil? (:fill-color head)))
(assoc :fill-color "#000000"))
(assoc :fill-color clr/black))
head-data (select-keys head stp/style-properties)]
(-> group

View file

@ -6,6 +6,7 @@
(ns app.main.data.workspace.colors
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.main.data.modal :as md]
[app.main.data.workspace.changes :as dch]
@ -203,7 +204,7 @@
(-> state
(assoc-in [:workspace-local :picking-color?] true)
(assoc ::md/modal {:id (random-uuid)
:data {:color "#000000" :opacity 1}
:data {:color clr/black :opacity 1}
:type :colorpicker
:props {:on-change handle-change-color}
:allow-click-outside true})))))))

View file

@ -6,6 +6,7 @@
(ns app.main.data.workspace.grid
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.spec :as us]
[app.main.data.workspace.changes :as dch]
@ -18,7 +19,7 @@
(defonce ^:private default-square-params
{:size 16
:color {:color "#59B9E2"
:color {:color clr/info
:opacity 0.4}})
(defonce ^:private default-layout-params
@ -27,7 +28,7 @@
:item-length nil
:gutter 8
:margin 0
:color {:color "#DE4762"
:color {:color clr/default-layout
:opacity 0.1}})
(defonce default-grid-params

View file

@ -7,6 +7,7 @@
(ns app.main.exports
"The main logic for SVG export functionality."
(:require
[app.common.colors :as clr]
[app.common.geom.align :as gal]
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
@ -32,7 +33,7 @@
[cuerdas.core :as str]
[rumext.alpha :as mf]))
(def ^:private default-color "#E8E9EA") ;; $color-canvas
(def ^:private default-color clr/canvas)
(mf/defc background
[{:keys [vbox color]}]

View file

@ -6,6 +6,7 @@
(ns app.main.ui.shapes.text
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.geom.shapes :as geom]
[app.main.ui.context :as muc]
@ -135,7 +136,7 @@
(filter some?))
colors (->> color-data
(into #{"#000000"}
(into #{clr/black}
(comp (filter #(= :solid (:type %)))
(map :hex))))

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.colorpicker
(:require
[app.common.colors :as clr]
[app.main.data.modal :as modal]
[app.main.data.workspace.colors :as dc]
[app.main.data.workspace.libraries :as dwl]
@ -49,7 +50,7 @@
;; --- Color Picker Modal
(defn color->components [value opacity]
(let [value (if (uc/hex? value) value "#000000")
(let [value (if (uc/hex? value) value clr/black)
[r g b] (uc/hex->rgb value)
[h s v] (uc/hex->hsv value)]

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.sidebar.options.menus.shadow
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.uuid :as uuid]
[app.main.data.workspace.changes :as dch]
@ -25,7 +26,7 @@
(let [id (uuid/next)]
{:id id
:style :drop-shadow
:color {:color "#000000" :opacity 0.2}
:color {:color clr/black :opacity 0.2}
:offset-x 4
:offset-y 4
:blur 4

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.sidebar.options.menus.stroke
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.math :as math]
[app.common.pages.spec :as spec]
@ -181,7 +182,7 @@
(fn [_]
(st/emit! (dch/update-shapes ids #(assoc %
:stroke-style :solid
:stroke-color "#000000"
:stroke-color clr/black
:stroke-opacity 1
:stroke-width 1))))

View file

@ -7,6 +7,7 @@
(ns app.main.ui.workspace.sidebar.options.page
"Page options menu entries."
(:require
[app.common.colors :as clr]
[app.main.data.workspace :as dw]
[app.main.data.workspace.undo :as dwu]
[app.main.refs :as refs]
@ -38,7 +39,7 @@
[:& color-row {:disable-gradient true
:disable-opacity true
:title (tr "workspace.options.canvas-background")
:color {:color (get options :background "#E8E9EA")
:color {:color (get options :background clr/canvas)
:opacity 1}
:on-change on-change
:on-open on-open

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.sidebar.options.shapes.svg-raw
(:require
[app.common.colors :as clr]
[app.main.ui.workspace.sidebar.options.menus.blur :refer [blur-menu]]
[app.main.ui.workspace.sidebar.options.menus.constraints :refer [constraint-attrs constraints-menu]]
[app.main.ui.workspace.sidebar.options.menus.fill :refer [fill-attrs fill-menu]]
@ -64,7 +65,7 @@
(get-in shape [:content :attrs :style :stroke]))
(parse-color))
stroke-color (:color color "#000000")
stroke-color (:color color clr/black)
stroke-opacity (:opacity color 1)
stroke-style (-> (or (get-in shape [:content :attrs :stroke-style])
(get-in shape [:content :attrs :style :stroke-style])

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.viewport
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.geom.shapes :as gsh]
[app.main.refs :as refs]
@ -65,7 +66,7 @@
objects (mf/use-memo
(mf/deps objects object-modifiers)
#(gsh/merge-modifiers objects object-modifiers))
background (get options :background "#E8E9EA")
background (get options :background clr/canvas)
;; STATE
alt? (mf/use-state false)