🐛 Fix problem when exporting texts with gradients or opacity

This commit is contained in:
alonso.torres 2021-11-02 19:20:17 +01:00 committed by Andrés Moya
parent bce0e9194c
commit 214c64c49e
7 changed files with 271 additions and 62 deletions

View file

@ -7,6 +7,7 @@
(ns app.util.color
"Color conversion utils."
(:require
[app.common.exceptions :as ex]
[app.util.object :as obj]
[cuerdas.core :as str]
[goog.color :as gcolor]))
@ -155,3 +156,19 @@
(def empty-color
(into {} (map #(vector % nil)) [:color :id :file-id :gradient :opacity]))
(defn next-rgb
"Given a color in rgb returns the next color"
[[r g b]]
(cond
(and (= 255 r) (= 255 g) (= 255 b))
(ex/raise "Cannot get next color")
(and (= 255 g) (= 255 b))
[(inc r) 0 0]
(= 255 b)
[r (inc g) 0]
:else
[r g (inc b)]))