saade / filament-autograph

A Filament package to collect signatures.
https://filamentphp.com/plugins/saade-autograph
MIT License
47 stars 9 forks source link

[Bug]: The color of the signature is saved with the color of the view mode #4

Open mendizalea opened 1 year ago

mendizalea commented 1 year ago

What happened?

If I save a signature in dark mode and then change to light mode, the signature is barely visible because it is displayed with the color used in dark mode.

How to reproduce the bug

Save signature in dark mode and change to ligt mode to edit or show.

Package Version

3.0.0

PHP Version

8.2.11

Laravel Version

10.26.2

Which operating systems does with happen with?

Windows, Linux

Notes

No response

saade commented 1 year ago

Hey @mendizalea, did you set ->penColorOnDark()? it defaults to the same color as penColor

mendizalea commented 1 year ago

@saade nothing defined, default color. I have tried to define but same problem:

->penColor('#000') ->penColorOnDark('#fff')

saade commented 1 year ago

hmm, yeah, this is expected since you've loading a .png that was saved to db with the dark pen color, i don't really have a good solution for this right now but i will investigate this

micraux commented 9 months ago

Hi, As a workaround, you could use an intermediate color, eg:

->penColor('#999')
->penColorOnDark('#999')

This way, you will always de able to see it

micraux commented 9 months ago

By the way, I see in the original docs (by szimek) that you can choose your data URL.

https://github.com/szimek/signature_pad?tab=readme-ov-file#usage

Have you implemented this feature? I mean the signaturePad.toDataURL() one?

I used to encode my signatures with the image/svg+xml and would like to be able to manage them with you plugin, but I think you are encoding in image/png.

That's why I would like to be able to use the signaturePad.toDataURL() feature.

Do you think it is possible?

saade commented 9 months ago

Yes its implemented, https://github.com/saade/filament-autograph/blob/3.x/resources/js/index.js#L87C40-L87C49

but we do not accept the encoding param, i've been busy lately so i can't say i'll implement this soon. But feel free to PR it =)

micraux commented 9 months ago

I would love to help but it is far beyond my programming skills...

micraux commented 7 months ago

@mendizalea, you can use ->exportPenColor() so that your signature always has the same color regardless of your penColor() or penColorOnDark() values.