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

Styling doesn't work well with Night Mode add-on for macOS client #156

Closed
tvanantwerp opened this issue Oct 17, 2019 · 5 comments
Closed
Labels

Comments

@tvanantwerp
Copy link

Without Night Mode:
image

With Night Mode:
image

This is with Anki for macOS version 2.1.15 and Night Mode plugin version 2.2.4.

@ruricolist
Copy link
Contributor

The same problem exists on Windows, again with Anki 2.1.15 and Night Mode 2.2.4.

@aplaice
Copy link
Collaborator

aplaice commented Oct 29, 2019

I can reproduce the issue on Linux, with Anki 2.1.15, Night Mode 2.2.4.

As far as I can tell, there are two issues with the Night Mode styling of anki-ultimate-geography:

  1. The info text overlaps with the main text.

  2. The colour of the info text isn't inverted, so it's difficult to see.

I don't think that either of the issues is really the "fault" of anki-ultimate-geography.


To reproduce 1., with the Night Mode addon turned on, but without anki-ultimate-geography, (only with a lightly-edited standard card type), change the "Front Template" of a "Basic" card to:

<div id=answer>{{Front}}</div>
<div>overlapping text</div>

(obviously remember to keep back-ups of the Template).

To reproduce 2., again with the Night Mode addon, but without the anki-ultimate-geography deck, add the following to the "Styling" of a "Basic" card:

div {
 color: #333;
}

Looking at the issues filed against Anki-Night-Mode, I think that issue "2.", above, is the same as krassowski/Anki-Night-Mode#52.

In principle, anki-ultimate-geography could use the work-around mentioned there; i.e. we could add something like:

.night_mode .info, .night_mode .type {
  color: #ccc;
}

to the CSS.

However, I'm not sure whether it's worth it, and more importantly, it doesn't deal with the more significant problem of the overlap (1.).

(There's also the issue that Anki now has its own in-built night mode, which apparently uses the nightMode class, so for completeness, the following would also be needed:

.nightMode .info, .nightMode .type {
 color: #ccc;
}

)

(I don't actually use the Night Mode addon, so if you're interested in having these solved, please file issues there and/or follow them up.)

PS It's a shame that neither Anki, nor the addon uses the new prefers-color-scheme media selector...

@axelboc
Copy link
Collaborator

axelboc commented Nov 3, 2019

The overlapping issue is strange, especially knowing it happens even in the simplest of cases, as you've demonstrated @aplaice. There's no point in working around the colour issue until this is resolved.

That being said, if Anki has a built-in night mode, we should definitely support it! How does it compare to the add-on? Has anyone tried it? If all it does is put a nightMode class on the card, then it's easy-peasy.

@aplaice
Copy link
Collaborator

aplaice commented Nov 8, 2019

Is it worth supporting?

How does it compare to the add-on?

Unless I've completely missed something, Anki's built-in night mode isn't that great, as it seems to only switch the card area to dark mode, but not the UI as a whole:

screenshot_2019-11-08_23:28:13

OTOH to be fair, the relevant preferences toggle just says "Show cards as white on black (night mode)" so it does exactly what it says. Also, I think (though I'm not 100% sure) that by customising one's Qt theme system-wide one can switch the UI to dark mode, so in some sense it's logical for Anki's toggle to only change the html part.

Additionally, the same night-mode styling is used in Anki mobile (on iOS).

(The night mode on iOS is actually a "proper" night mode, with the entire UI also themed (or at least it was in version 2.0.48, which is the latest that my ancient not-really-used iOS device can support, but it's unlikely to have become worse...)

Like the built-in Anki desktop night mode and the add-on-enabled night mode, (and unlike Ankidroid) Anki mobile's dark mode does not automatically invert font colours other than pure black and white, so like them, it displays the info text as dark grey on black. (Or at least it didn't do automatic inversion in my old version. However, since the current Anki mobile manual still refers to customisable night mode styling, it's plausible that no automatic colour-inversion has been introduced.)

Hence, overall, it might be worth supporting Anki's built-in night mode.

Is it easy to support?

If all it does is put a nightMode class on the card,

Yes, that's all it does.

then it's easy-peasy.

Indeed. Using the above CSS snippet:

.nightMode .info, .nightMode .type {
 color: #ccc;
}

fixes the styling of the additional info text:

screenshot_2019-11-08_23:41:13

It similarly fixes the styling on (my old version of) Anki mobile. (I'm not attaching screenshots since I can't be bothered to figure out how to easily copy images from my iOS device, since I don't really use it (I only bought Anki on it to support Anki development and for occasional testing, like now :)).)

aplaice added a commit to aplaice/anki-ultimate-geography that referenced this issue Nov 17, 2019
This deals with the issue of the info (and "type") text being
displayed as dark grey on black.

This is not necessary for Ankidroid, since Ankidroid dark mode
automatically inverts all text colours, but doesn't hurt either.

Once anki-geo#156 is resolved, one could consider adding a selector for
.night_mode, for the popular dark-mode add-on.
aplaice added a commit to aplaice/anki-ultimate-geography that referenced this issue Nov 17, 2019
This deals with the issue of the info (and "type") text being
displayed as dark grey on black.

This is not necessary for Ankidroid, since Ankidroid dark mode
automatically inverts all text colours, but doesn't hurt either.

Once anki-geo#156 is resolved, one could consider adding a selector for
.night_mode, for the popular dark-mode add-on.
axelboc pushed a commit to aplaice/anki-ultimate-geography that referenced this issue Nov 17, 2019
This deals with the issue of the info (and "type") text being
displayed as dark grey on black.

This is not necessary for Ankidroid, since Ankidroid dark mode
automatically inverts all text colours, but doesn't hurt either.

Once anki-geo#156 is resolved, one could consider adding a selector for
.night_mode, for the popular dark-mode add-on.
@axelboc
Copy link
Collaborator

axelboc commented Nov 17, 2019

Closing this with wontfix until krassowski/Anki-Night-Mode#87 is resolved. That being said, Anki's built-in dark mode is now supported thanks to @aplaice #173. 💯

@axelboc axelboc closed this as completed Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants