Skip to content

Instantly share code, notes, and snippets.

@sritchie
Last active October 31, 2017 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sritchie/c361d6c277c8f161972c to your computer and use it in GitHub Desktop.
Save sritchie/c361d6c277c8f161972c to your computer and use it in GitHub Desktop.
Instructions for how to have Kanji Colorizer not replace a field with other text in it.
# This is useful for multi-Kanji words; once you've deleted everything but the first Kanji, you want
# the colorizer to leave the field alone.
# 1) Look for the line that starts with `def addKanji(note, flag=False, currentFieldIndex=None)`
# 2) Scroll down almost to the bottom of that function (where the lines are indented,
# right above the "Add a colorized..." bit of text
# 3) Replace this line:
note[dstField] = dst
# With this:
if not note[dstField]:
note[dstField] = dst
# Restart Anki and you'll be good to go! This basically checks if the field's empty, and does nothing if it is.
# If the field's NOT empty, it replaces it with the new, snazzy colorized kanji images.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment