-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: persist colour picker's custom palette in profile #4326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
there doesn't seem to be an event fired when the picker is cancelled/closed, so it's still possible for work to be lost
`input` is supposed to be fired on every adjustment to the picker whereas `change` is only fired when the picker is accepted, but qt seems to treat both as the latter, so this is currently a no-op
|
I think the RPC approach is good. Better to save the colors immediately than potentially lose them if Anki doesn't exit cleanly. I gave this a test on macOS and it appears to be working well. |
|
Do you think it's worth saving to the collection itself? This'd anticipate the note editor getting ported to mobile clients where the native browser's colour picker might not allow changing the palette (pic below is from ankidroid, for example): This way users can save their favourite colours on desktop and use them on mobile related: https://forums.ankiweb.net/t/add-an-input-field-in-io-fill-colour-to-type-out-the-colours/63579/2 |
It's bothering quite a few users, so I think that's the right call. Thanks for figuring out a workaround! I'll get this into 25.09.1. (edit: whoops: #4320 (comment))
Yeah, good call. It's not a lot of data, and it will avoid work for users in the future if we decide to switch. |
One minor tweak to the logic while I was there: an invalid color no longer invalidates all the rest.
|
This fix did not work for me. Please investigate - thanks! |
|
I now understand the problem - the link to the latest version 25.09 for MacOS installs 25.07 NOT 25.09 even though the filename says 25.09. If, however, you then upgrade from within 25.07 to 25.09 using the Tools>Upgrade launcher then 25.09 installs and the custom colors are now sticky - thanks for the fix but please update the initial download link to avoid confusion! |
* add SaveCustomColours rpc method * restore custom colour palette on editor init * save custom colour palette on colour picker open and input there doesn't seem to be an event fired when the picker is cancelled/closed, so it's still possible for work to be lost * save colours on `change` instead of `input` `input` is supposed to be fired on every adjustment to the picker whereas `change` is only fired when the picker is accepted, but qt seems to treat both as the latter, so this is currently a no-op * Store colors in the collection One minor tweak to the logic while I was there: an invalid color no longer invalidates all the rest. --------- Co-authored-by: Damien Elmes <[email protected]>

Closes #4233
Custom palette colours are currently reset when anki is restarted. This pr proposes to save them to the current profile. Tested on win 10 and wsl ubuntu
I understand its a qt regression, but without a timeline on when/if it'll get fixed, i reckon its worth handling in anki in the meantime
A quirk with this impl is that (afaik) there is no event for when the picker is closed without a colour being selected. So i've chosen to save the palette when its both opened and when a colour is selectedNB: the rpc is likely overkill, as the colours can be saved anytime before anki exits. thoughts on where this should be?
EDIT2:
SaveCustomColoursis intended to be implemented as a no-op on mobile clients