Hello!
I want to change all the ocurrences of a color defined in the local library with another one (library colors are of type LibraryColor).
I saw that within the penpot (or context) object lies a method replaceColor(shapes: Shape, oldColor: Color, newColor: Color) that is supposed to change the color of a bunch of shapes for a new one (just what I want hehe), however, when I try to use it in my plugin, penpot frontend show an internal error screen and a report file (that I attached at the end of this topic) is generated.
I don’t yet know why is this happening, I’ll keep trying to find a reason and if possible, solve it, I believe it is caused because I’m casting a LibraryColor into a Color.
For now I’ll use a workaround by changing all the attributes that use colors in the Shapes (fill, stroke, etc), but, has someone faced this issue?, or maybe someone have a more detailed usage example of this method?
Thanks for reading this =)
Report File:
Hint: No matching clause:
Prof ID: a5adc15f-fb38-8092-8005-3959c8def840
Team ID: a5adc15f-fb38-8092-8005-3959c8df216f
Data:
{:hint "No matching clause: "}
Trace:
u@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:3434:42
PENPOT.Ifc/NY.prototype.ma/<@https://design.penpot.app/js/main.33d51a51d-1730738783.js:2754:404
PENPOT.ERa/<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:4347:75
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:221:227
d@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:150:99
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:12
shadow$provide[1]/m/<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:151:498
_trySubscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:85
subscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:25
shadow$provide[43]/n.map/</<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:221:172
_trySubscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:85
subscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:25
v@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:243:286
q@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:243:218
d@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:150:99
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:12
t@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:152:277
shadow$provide[1]/k/<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:151:314
_trySubscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:85
subscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:25
shadow$provide[62]/n.mergeInternals@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:244:42
shadow$provide[63]/n.mergeMap/</<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:245:210
_trySubscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:85
subscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:25
shadow$provide[98]/a/</<@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:286:105
_trySubscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:85
subscribe@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:161:25
PENPOT.Qw@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:4351:470
PENPOT.Rw@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:4352:230
b@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:6991:109
@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:6992:463
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:160:105
_next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:302
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:12
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:171:42
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:348:198
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:160:105
_next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:302
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:12
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:363:301
d@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:150:99
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:159:12
next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:171:42
y.next@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:6993:38
sM.J@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:6980:442
PENPOT.Z.j@https://design.penpot.app/js/shared.33d51a51d-1730738783.js:6995:395
PENPOT.g.replaceColor@https://design.penpot.app/js/main.33d51a51d-1730738783.js:4723:440
replaceColor@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:8007:46
Ml/get/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:8095:21
t/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:303
t@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:264
t/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:400
t@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:372
t/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:400
t@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:372
t/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:400
t@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:372
t/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:400
t@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:372
@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099 line 2918 > Function line 12 > eval:1:803
$l/sendMessage/<@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:7877:25
sendMessage@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:7877:9
@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:8230:16
EventListener.handleEvent*@https://design.penpot.app/plugins-runtime/index.js?ts=1730739141099:8227:8
Last events:
[":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.undo/start-undo-transaction"
":app.main.data.workspace.colors/change-color-in-selected"
":app.main.data.workspace.colors/stop-picker"
":app.main.data.modal/hide-modal"
":app.main.data.notifications/hide"
":app.main.data.workspace.notifications/finalize"
":app.main.data.workspace.shape-layout/finalize"
":app.main.data.workspace/finalize-file"
":app.main.data.workspace/finalize-page"
":app.main.data.shortcuts/pop-shortcuts"
":app.main.data.events/event"
":app.main.data.plugins/remove-current-plugin"]