177 5
Sign in to rate

Night Mode

0.02MB. Updated 2018-06-12. Supports both Anki 2.0.x and 2.1.x.

Description

This plugin adds the function of night mode, similar that one implemented in AnkiDroid*. It adds a "view" menu entity with options like: - Automatic (i.e. at specified time) or manual switching of the night mode - Inverting colors of images or latex formulas - Defining custom color substitution rules It provides shortcut ctrl+n to quickly switch mode and a color picker to adjust background and text colors to your liking. After enabling night mode, add-on changes colors of the menubar, toolbar, bottom bars, and contents. When the option "Enable in dialogs" is ticked, it also changes colors of most of the dialog windows (like: 'Add card', 'Browser', 'Statistics', etc.). If "force transparent latex" is enabled, new latex formulas should be generated with transparent background (delete old files to regenerate formulas created before). This add-on is Anki 2.1 compatible (tested with beta 16-40). If you want to contribute, please visit GitHub repository: krassowski/Anki-Night-Mode. Polite requests Please do not write bug reports on this page. I cannot reply here, and ask you for details which are often crucial to solve your problem :( It's a better idea if you use GitHub (preferred) or e-mail: krassowski.michal@gmail.com If you find this add-on useful, please grade it or write a review :) Also, feel free to send me bug reports or feature requests on GitHub (as well as to fork and star the repository). Changelog If you want to update your copy of this add-on, please remove it and install again from Anki menu. Please note that the 2.x version of the addon (and it's new features) is only available when running Anki 2.1.x == 2.1.7 - June 12, 2018 - Allow to selectively disable reviewer card's styling in the "Choose what to style" dialog #38 - Sort stylers in the "Choose what to style" dialog alphabetically - Add "check all / uncheck all" to in "Choose what to style" dialog - Fix night_mode CSS class being applied regardless of night mode state #37 == 2.1.6 - February 21, 2018 - Improve visibility of items in table in browser #28 (thanks nathanmalloy!) - Provide potential workaround for Qt bug causing Chinese text to be rendered black when selected == 2.1.5 - January 21, 2017 - Allow to selectively disable parts of the add-on #25, #26 == 2.1.4 - January 20, 2017 - Add night styling to "Statistics" window (styles are applied when "enable in dialogs" option is on) #9. == 2.1.3 - January 15, 2017 - Add compatibility with 2.1 beta 31 (which changed progress dialogs interface). == 2.1.2 - September 23, 2017 - Use night mode colors for synchronization/backup progress pop-up dialogs. - Minor fix: make selected rows in card browser use night mode colors again. == 2.1 - September 22, 2017 - New option: "Automatic mode" (suggested by p2635: #22) - allows to set times at which the nigh mode should be automatically turned on and off. - New option: "Customise colors on cards" - defining custom color mappings just got easier with a new dedicated dialog window - no need to modify source files anymore! == 2.0 - September 19, 2017 - new, rewritten addon, compatibile with Anki 2.1.x Beta 13+. == 1.2.3 - September 6, 2017 - bug fix: make text over difficulty buttons easier to read The full changelog is available on GitHub. Known issues - In browser, the tag tree sidebar was twice observed to disappear when resized in the old (2.0) Anki version on Windows, which may (or may not) be related to changes made by this addon. Use of newer (2.1) Anki version is recommended. - At times some internal formatting breaks when pasting, cutting or entering a new line and causes edited line/text to appear completely white (issue #27). Some workarounds were described for a similiar problem here. It is difficult to fix, but anyone willing to help is encouraged to try and create a pull request later. Known issues from old versions - In some installations on Windows and Mac OS inversion of images doesn't work. This is probably related with some issue of third party library displaying content in Anki - I cannot do anything about it. - Typing Korean and Chinese is problematic - you can find some workarounds on this issue page. If you experience any of the issues above and know a bit about programming, please feel free to join the discussion on GitHub to help fixing these. Night-Mode integrates well with Anki-Zoom for 2.1 - don't forget to check it out! * The add-on is not affiliated with AnkiDroid. Installation of the add-on on your desktop will not affect how your mobile client works.

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

To download this add-on, please copy and paste the following code into the desktop program:

1496166067

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

Other Anki 2.0.x Add-Ons Other Anki 2.1.x Add-Ons Ask a Question

Reviews

on 1529367551
Fantastic. Works well with the Zanki deck and the Zoom add-on.
on 1529005879
Great
on 1528973660
something that should be there by default, but this also works, dark mode ftw
on 1528588800
Nice addon, much more confortable to do reviews with Night Mode enabled!
on 1527292800
Nice! For some reason, the text on my anki browser was extremely hard to see against a similarly light background -- now I can see stuff perfectly! It looks pretty nice, and is easy on the eyes.
on 1526947200
Your add-on saved my eye! Thanks!
on 1525824000
It rescues my eyesights.
on 1525651200
Just what I needed.
on 1525392000
Comfy
on 1524960000
Super cool at night :)
on 1524700800
2/5 incompatible with a lot of other add-ons. But my biggest complaints lies within not being able to select which deck to activate "night mode" on, and which deck not using night mode on, since it ruins the look of decks that use heavily CSS theming.
on 1524528000
Saves my sanity
on 1524441600
Aesthetically pleasing and easy on the eyes
on 1523923200
Useful
on 1523404800
Makes it a lot more pleasant to study these cards at night now
on 1522627200
Very good!
on 1522627200
Works as intended
on 1522108800
It works great.
on 1521849600
Handy.
on 1521244800
Well done!
on 1520985600
Perfect!
on 1520985600
Nice black
on 1520899200
helps my eyes
on 1520553600
cool
on 1520035200
I love this!
on 1519862400
Dark mode is what I love on my monitor.
on 1519257600
Thank you, my eyes aren't particularly fond of staring at the bright screen for long periods of time so this is very helpful!
on 1518566400
This is awesome!
on 1517702400
Very good, but is there any way to change the color of the "Extra Text" in cloze like Ankidroid does it (yellow on black)... Dark blue on black is unreadable, was able to change cloze text in code but can't find extra.
on 1517097600
Good extension, very useful!
on 1517011200
great
on 1516579200
Great Addon!

Only major bug I've been experiencing is that Anki Crashes when Syncing!
I have the zanki deck loaded (1gb), so this may play a part in it. If anyone/the dev know of a solution, please let me know!
on 1516233600
Does what is advertised and more. The color swapping is very useful for quick changes. I realise this is called Night Mode and all but with it's versatility could you implement themes/presets so a person can switch from dark to sepia etc on the fly.
Also thanks to the kind reviewer down below suggesting f.lux.
on 1516233600
Perfect
on 1516060800
Pair this up with https://ankiweb.net/shared/info/1333758373 and properly thank your eyes for all the hard work they do when you're at the computer.
on 1515974400
not working on beta 31 (anki 2.1) :(
still giving it a thumbs up
on 1515542400
Excellent! Just what my eyes needed.
on 1515456000
Great´╝ü
on 1515024000
Good
on 1514592000
This happened after using AnkiMobile iOS version. May be related or just a coincidence!

Switching night mode failed: Something went really really wrong.
Contact add-on author to get help.

Please provide following traceback when reporting the issue:
Traceback (most recent call last):
File "/Users/Library/Application Support/Anki2/addons/Night_Mode.py", line 598, in nm_on
File "/Users/Library/Application Support/Anki2/addons/Night_Mode.py", line 567, in nm_append_to_styles
File "aqt/deckbrowser.pyc", line 30, in refresh
File "aqt/deckbrowser.pyc", line 142, in _renderPage
File "anki/sched.pyc", line 261, in deckDueTree
File "anki/sched.pyc", line 246, in deckDueList
File "anki/sched.pyc", line 426, in _newForDeck
File "anki/db.pyc", line 76, in scalar
File "anki/db.pyc", line 43, in execute
InterfaceError: Error binding parameter 0 - probably unsupported type.
on 1513728000
Font colours keep getting messed up when editing existing notes.

For example, as I learn new kanji, I modify existing flash cards during my review to include the new kanji I have learned. When I do this I like to hit CTRL+Home and then press enter a few times to create space in the expression field of a flashcard for me to type words with updated kanji. I then paste these words into the original sentence, and reading. I then delete the extra unneeded characters. I have better luck doing this as I'm pretty picky with my furigana readings on my cards. If I do this with this add-on installed and enabled, the font colours get screwed up on my cards. When text should be white in night mode, it starts to show up as black, and when it should be black in night mode it shows up at white.

I un-installed because of this.
on 1513641600
ATTENTION FOLKS

If you have severe problems with staring at a bright computer screen, consider:
(a) increasing your intake of vitamin A (if your eyes hurt when you look at a computer screen, that is a telltale sign of vitamin A deficiency)
(b) installing the free software called Flux (download: https://justgetflux.com/) on your computer. The purpose of this software is exactly to make your eyes not hurt when you look at the computer screen. It does so by lowering the blue-spectre color of the screen (which is what causes the sensation of eye burning). Install Flux, then set it to lower the blue-spectre color of your computer screen: you will notice that the "eye burning" sensation magically goes away and you can use the computer normally.

The add-on is good and all, but I want to point those things out. :)
on 1513036800
Its works!
on 1512518400
The eyes refuse to work without this addon. Well done!
on 1512259200
Great looking dark theme
on 1512000000
Thank you immensely!

I really love this feature in AnkiDroid and now can happily enjoy using it in desktop version.
on 1511740800
Gut fuer nacht lernen.
on 1511740800
love it !
on 1511395200
Great!!!!
on 1511395200
Much needed.
on 1511222400
GREAT!
on 1510790400
It looks so much better! Would like more of these skins to make Anki feel less old school.
on 1510704000
IT IS JUST AWESOME
on 1510704000
very useful
on 1502928000
How to fix issues with multiple plugins

As someone else has mentioned in the reviews, other plugins do not always work well with this plugin.
The workaround for this is to edit the plugins. See menu bar: Tools>add ons>your addon>edit

Example #1: for a font plugin set font color 000000 (black) to ffffff (white)
(this worked with the plugin KanjiInfo)
Example #2: for a replay button plugin, set button color black to white
(this worked with the plugin Replay buttons on card)
on 1502409600
Nice add-on!

Converts the most frequently used parts of Anki to a nice dark theme.
I've had no issues when using it (stand-alone)
Thank you for maintaining this add-on!
on 1499990400
This is awesome!

Unfortunately it has minor issues with other plugins but it's completely fine.
on 1494288000
Beautiful

That's really beautiful. I love it.
on 1493424000
Thank you!

It's very useful , thank you author.
on 1491523200
Beautiful, but...

I am using the version from March 2017. I have experienced only two issues, so far:
1. If the file browser window is not maximized completely, the user is not allowed to resize and widen the left panel. When maximized, he is allowed to resize it, but still not as much as before installing your addon.
2. The first few drop-down menus on the left side of the screen look great, but the last few menus retain their original color scheme.
Some of this may be the fault of other addons conflicting with yours, but I noticed these things only after installing your addon, so I assume that it is because of your addon.
Thanks for your hard work: the rest is working well, and makes everything easier to read.
on 1488326400
Great except one problem

I've also found another bug. After creating new cards when using this add-on, when you're NOT using this add-on to study those cards, those cards are sometimes problematic: text with white color. You might think that's an empty card but try highlighting those empty space, you'll see the text.

========================================================================
When I am typing Korean while reviewing, the Hangul disappears after deleting a word. To illustrate this problem more clearly, I will use English as as example:
Type: " I am learning Korean.", after deleting the word "Korean", the whole sentence is gone unless I click away from the texting box and click back again.
This problem happens in other languages except English. Please fix this. Thank you very much:)
on 1487203200
Perfect!

That's what I was looking for!

Thanks man!
on 1485561600
The button's on the bottom are skewed

Gave this 3 stars pending a fix on the buttons that become large and skewed when night mode is activated during study. The "again, hard, good and easy" buttons are not visible at all. Also, the review card amount tracker is not enabled.
on 1484438400
THANK YOU!
on 1482278400
Perfect

Works fine.
on 1477267200
Amazing! So glad I found this add-on!

Does exactly what I've been trying to do for the past few weeks.

It lets me choose the background color, the text color, and I was able to go into the code and change the cloze color easily.

Thank you so much for this!
on 1472428800
Pretty good

YSK that you can use it to have different CSS in day mode and night mode. tag <body> has a class "night_mode", so you can use something like this to style other classes.

.q {color: #494a7f;} /* normal mode */
.night_mode .q {color: #a9aaef;} /* night mode */

Copying text from dialogues sometimes copies the the text colored, so that's a bit of a drawback
on 1464566400
Anki graphs

please add Night Mode for Anki graphs like this style. thank you.

http://s7.picofile.com/file/8253518984/Night_mode_graph.png
on 1463702400
Must have this one.

Takes care of your eyes.
on 1461283200
Looks awesome!

Smooth functionality and looks sweet. No more nighttime eye strain.
on 1457308800
Brilliant!

This theme is fantastic. Thank you.

Minor issue: the scrollbar in the Browser is still black.
on 1456790400
Almost perfect!

Almost perfect. That's exactly what I was looking for. There is a minor imperfection, though: the review buttons don't get highlighted when they have the focus, so you can't tell which button is currently selected,

Apart from that, great great addon! Don't forget to check the Enable In Dialogs menu check boxs as well!
on 1454112000
Excellent, almost perfect

This add-on has made my evening reviews much easier on the eyes and also more fun :) I noticed that there are still UI text elements that are black, such as the "+-" expand/contract to the left of each deck with subdecks. This being fixed, it would be perfect.

EDIT (1/29/2016): Thank you for the fix! It's perfect now!
on 1452902400
so great for protecting your eyes..........

I like this addon so much.......it really helps to protect my eyes.......thank you for your addon......it's very useful..........
on 1451260800
Amazing unless you use hyperlinks[Fixed]

Amazing now....
on 1450828800
could be great...

all of my cards contain LaTeX equations and it kind of defeats the purpose to go into Night Mode since it doesn't invert the color of the PDFs ... just get a bright white block with equation on a black background...
on 1448841600
Awesome.

I've been waiting for this kind of addon for so long. Thank you so much!
on 1448323200
Great!

This is one of my favorite add-ons :D
on 1444867200
Great

Does what the title says.
Very Nice! Missed this function before.
on 1438214400
invert image

Firstly, I would like to say "thank you" for developer of this add-on!
But I can invert image with this add-on actually!
Hope you can fix as soon as possible!
Thanks again!^^
on 1437868800
Very useful

I use it even at daytime because I hate bright light.
Some minor problem/s:
Usually buggy, especially when syncing Anki would sometimes crash (or maybe that's just me because I have a really large collection).
Doesn't work on some dialogs (browser, options, etc)
on 1434931200
Bug report.

https://anki.tenderapp.com/discussions/add-ons/4165-night-mode-add-on-bug
on 1433203200
Great for studying in the dark

I agree with my foretalkers: Great addon!

I also agree on the major drawback: Brower and Add-Dialog should be styled black too.

Another drawback is the missing ".night"-CSS-Styles, that are supported in AnkiMobile.

One Solution is to overwrite Anki's function for generating the card's html with one that also interprets the nm_state_on variable:

<code>
from anki.utils import isMac, isWin
from anki import js
import anki
from aqt import webview

def stdHtml(self, body, css="", bodyClass="", loadCB=None, js=None, head=""):
# this is new:
if nm_state_on:
bodyClass = bodyClass + " night"

if isMac:
button = "font-weight: bold; height: 24px;"
else:
button = "font-weight: normal;"
self.setHtml("""
<!doctype html>
<html><head><style>
button {
%s
}
%s</style>
<script>%s</script>
%s

</head>
<body class="%s">%s</body></html>""" % (
button, css, js or anki.js.jquery+anki.js.browserSel,
head, bodyClass, body), loadCB)

webview.AnkiWebView.stdHtml = stdHtml
</code>
on 1430870400
Great plugin

Great plugin. thanks for taking the time to write this.