Skip to content
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

All custom flag and card state colors displaying black in browse window #38

Closed
4 of 5 tasks
madglass opened this issue Sep 15, 2024 · 1 comment · Fixed by #40
Closed
4 of 5 tasks

All custom flag and card state colors displaying black in browse window #38

madglass opened this issue Sep 15, 2024 · 1 comment · Fixed by #40
Labels
bug Something isn't working

Comments

@madglass
Copy link

Problem description

*Regardless of the color selected, the flag icons and their corresponding flag "highlight" are black in browse. The card state "swatch" has the same issue. Problem seems to be limited to the browse window; colors display properly on main screen and during review. It's occurring on both my desktop and laptop.

However, if using a default theme (Catppuccin, Nord, etc.) the card states and flag colors/highlights display properly in browse.

Attached screenshot is the result of attempting to change the red flag and "new" card state to a custom color.*

Screenshot 2024-09-15 at 3 19 31 PM

Checklist

Please replace the space inside the brackets with an x if the following items apply:

  • I've restarted Anki to see if it helps
  • I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
  • I've tried to disable other add-ons to see if there are any interactions present
  • My issue disappears when I hold shift while starting Anki.
  • I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

What Anki version are you using?

Version ⁨23.12.1 (1a1d4d54)⁩
Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: macOS-14.5-arm64-arm-64bit

Error message (if any)

If you've received an error message, please copy and paste it between the backticks below:


@madglass madglass added the bug Something isn't working label Sep 15, 2024
@iamllama
Copy link
Contributor

iamllama commented Dec 8, 2024

The issue is that the colours listed in backend_color_to_aqt_color are passed directly into QColor in adjusted_bg_color, which does not take RGBA hex nor the rgba(...) format

https://github.com/ankitects/anki/blob/039c7fc0a9cee81b975e6419d9be20aef338db8f/qt/aqt/browser/table/__init__.py#L125-L134

Though for some reason, according to https://doc.qt.io/qt-6/qcolor.html#fromString, it takes ARGB hex 🤔

A simple fix would be to strip the alpha away (or prepend it to form #ARGB) when anki_name is one of those colours in replace_color

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants