From 481e9b0d324f1156929e08406c904ce4413fb946 Mon Sep 17 00:00:00 2001
From: "alonso.torres" <alonso.torres@kaleidos.net>
Date: Fri, 10 Mar 2023 10:58:40 +0100
Subject: [PATCH] :bug: Fix unlink library color when blur color picker input

---
 CHANGES.md                                          | 1 +
 frontend/src/app/main/ui/workspace/colorpicker.cljs | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index caf44f2ff..dae12bee0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -26,6 +26,7 @@
 - Changed the text dominant-baseline to use ideographic [Taiga #4791](https://tree.taiga.io/project/penpot/issue/4791)
 - Viewer wrong translations [Github #3035](https://github.com/penpot/penpot/issues/3035)
 - Fix problem with text editor in Safari
+- Fix unlink library color when blur color picker input [#3026](https://github.com/penpot/penpot/issues/3026)
 
 ### :arrow_up: Deps updates
 
diff --git a/frontend/src/app/main/ui/workspace/colorpicker.cljs b/frontend/src/app/main/ui/workspace/colorpicker.cljs
index 3f6f3a72b..9f8ee7e73 100644
--- a/frontend/src/app/main/ui/workspace/colorpicker.cljs
+++ b/frontend/src/app/main/ui/workspace/colorpicker.cljs
@@ -65,11 +65,12 @@
 
         handle-change-color
         (mf/use-fn
-         (mf/deps @drag?)
+         (mf/deps current-color @drag?)
          (fn [color]
-           (let [recent-color (merge current-color color)
-                 recent-color (dc/materialize-color-components recent-color)]
-             (st/emit! (dc/update-colorpicker-color recent-color (not @drag?))))))
+           (when (not= (str/lower (:hex color)) (str/lower (:hex current-color)))
+             (let [recent-color (merge current-color color)
+                   recent-color (dc/materialize-color-components recent-color)]
+               (st/emit! (dc/update-colorpicker-color recent-color (not @drag?)))))))
 
         handle-click-picker
         (mf/use-fn