Currently reviewing some of my anki cards and for some strange reason the formatting of them has all gone strange: random parts of the text are highlighted, some of the font colours have been changed to black so I can’t even really read the words on the back of the cards and the alignment of the text is all mixed up.
Pretty likely the problem is going to be the card template contents or the Styling. Could you post the whole content from (just paste the text in three sections not a screenshot, if you could):
Can you go to your card browser, find a card with unwanted formatting and press the < > button next to the field? It will display the html version of that field. Please paste the html here, so we can check if that is the culprit.
Also: Are your cards with unwanted formatting using this exact card template that you showed us here? E.g. if your cloze cards look like the formatting is off, then we’d have to see the templates of the cloze cards.
Something I just noticed using the cards this morning as compared to last night, is that the formatting error actually only occurs when my laptop goes into ‘Night Mode’ and the brightness is changed. Could that help in trying to solve it?
Couldn’t find the <> button next to the ‘field?’, could you please expand?
But what I have found is that when I go to “Browse”, pick one flashcard and then go to “Cards…”, on the preview side there is the ‘Options’ drop down menu on the ‘Preview’ side. When I select ‘Night Mode’ and toggle to the ‘back preview’ of the card that is when it shows the formatting as all messed up: text colour changes to black on some words which blends into the background and then means I can’t read them. However, the codes for “Front”, “Back” and “Style” are all the same as what I posted before so not sure what it is that changes.
Since the problem wasn’t the HTML or CSS in your card template. Perhaps there is some html in the fields themselves that is doing something weird. Possibly there’s something like <span style="color: black"> ... </span>
But what I have found is that when I go to “Browse”, pick one flashcard and then go to “Cards…”, on the preview side there is the ‘Options’ drop down menu on the ‘Preview’ side. When I select ‘Night Mode’ and toggle to the ‘back preview’ of the card that is when it shows the formatting as all messed up: text colour changes to black on some words which blends into the background and then means I can’t read them. However, the codes for “Front”, “Back” and “Style” are all the same as what I posted before so not sure what it is that changes.
Switching to Night Mode ought to switch background to dark and text color to white unless there is some CSS in the card template or the field’s html saying that text color should always be something else.
This is what I found when I found the toggle on the card like you instructed:
<b><div><img src="Screenshot%202024-12-19%20at%2013.46.41.png"><span style="font-weight: 400;"><br></span></div><div><span style="font-weight: 400;">(noun)</span></div><ul><li><div><span style="color: rgb(37, 37, 40); font-weight: 400;">the state or capacity of being everywhere, especially at the same time</span></div></li></ul><div><span style="font-weight: 400;">E.g</span></div><ul><li><b><span style="font-weight: 400;">‘the </span><span style="font-weight: 400; font-style: italic;">ubiquity</span><span style="font-weight: 400;"> of mobile phones means you don’t really need a watch’</span></b></li></ul></b>
No clue what it means if anyone can help decipher it or find a fix for this problem!
Modifies how thick your text will be (→ you can make it bolder).
This sets a specific font color to a black / grey tone. This might be the problem you’re experiencing when turning on dark / night mode, as this text won’t change to the inverse color now (it stays black / grey no matter the theme).
This makes the font italic.
I’d remove the color style if I where you. That should probably fix your issue.
Thanks so much. Do I have to do that for every card I make or is there a way I can code it to make sure that all the cards colour is able to turn to white when in dark mode when the background changes to black?
Unfortunately, if you have a lot of formatting in your note fields, you have to remove it from there before formatting on your card templates, note type Styling, or theme can control.
Find and Replace is your best bet. It’s important to craft a good regex search and limit your Find to certain fields and notes – to make sure you’re not changing (or breaking) anything you intended to keep. Regex looks like gibberish , but it’s actually pretty easy to get the hang of.
What helps is that you don’t have to remove the entire <span> or <div> tag (so you also don’t have to remove their ending tag </> partners), you only need to remove the part that’s changing the color. This will be a good time to make a fresh backup [File > Create Backup] before you start making changes and remember that you can Edit > Undo to get back from almost anything.
As a first step, do as many searches as you can to find samples of HTML that you want to change – and HTML that you want to keep. Then if you need help fine-tuning your regex, someone should be able to take a look!