Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@iamllama
Copy link
Contributor

@iamllama iamllama commented Sep 9, 2025

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 selected

NB: the rpc is likely overkill, as the colours can be saved anytime before anki exits. thoughts on where this should be?

EDIT2: SaveCustomColours is intended to be implemented as a no-op on mobile clients

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
@iamllama iamllama changed the title fix: persist colour picker's custom palette fix: persist colour picker's custom palette in profile Sep 9, 2025
`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
@abdnh
Copy link
Collaborator

abdnh commented Sep 14, 2025

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.

@iamllama
Copy link
Contributor Author

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):
image

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

@dae
Copy link
Member

dae commented Sep 17, 2025

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

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))

Do you think it's worth saving to the collection itself?

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.

dae and others added 2 commits September 17, 2025 16:39
One minor tweak to the logic while I was there: an invalid color no
longer invalidates all the rest.
@dae dae merged commit 80cff16 into ankitects:main Sep 17, 2025
1 check passed
@campbellgunn-j
Copy link

This fix did not work for me. Please investigate - thanks!

@campbellgunn-j
Copy link

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!

AmandaSternberg-creator pushed a commit to AmandaSternberg-creator/anki that referenced this pull request Sep 25, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Colors Not Sticky Anymore

4 participants