Skip to content

Commit

Permalink
remove color inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
RobozinhoD authored and lukstbit committed Dec 9, 2023
1 parent 1747ac9 commit dc45c0d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.ichi2.anki.cardviewer
import android.content.SharedPreferences
import androidx.annotation.CheckResult
import com.ichi2.anki.reviewer.ReviewerCustomFonts
import com.ichi2.libanki.Card
import com.ichi2.themes.Theme
import com.ichi2.themes.Themes.currentTheme

Expand Down Expand Up @@ -87,12 +86,5 @@ class CardAppearance(private val customFonts: ReviewerCustomFonts, private val c
// font-weight to 700
return content.replace("font-weight:600;", "font-weight:700;")
}

/**
* hasUserDefinedNightMode finds out if the user has included class .night_mode in card's stylesheet
*/
fun hasUserDefinedNightMode(card: Card): Boolean {
return card.css().contains(nightModeClassRegex)
}
}
}
11 changes: 1 addition & 10 deletions AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/CardHtml.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ package com.ichi2.anki.cardviewer
import android.content.Context
import com.ichi2.anki.R
import com.ichi2.anki.TtsParser
import com.ichi2.anki.cardviewer.CardAppearance.Companion.hasUserDefinedNightMode
import com.ichi2.libanki.*
import com.ichi2.libanki.Sound.SingleSoundSide
import com.ichi2.libanki.Sound.SingleSoundSide.ANSWER
import com.ichi2.libanki.Sound.SingleSoundSide.QUESTION
import com.ichi2.libanki.template.MathJax
import com.ichi2.themes.HtmlColors
import com.ichi2.themes.Themes.currentTheme
import net.ankiweb.rsdroid.RustCleanup
import org.json.JSONObject
import timber.log.Timber
Expand All @@ -37,7 +34,6 @@ class CardHtml(
@RustCleanup("legacy")
private val beforeSoundTemplateExpansion: String,
private val ord: Int,
private val nightModeInversion: Boolean,
private val context: HtmlGenerator,
/** The side that [beforeSoundTemplateExpansion] was generated from */
private val side: Side,
Expand Down Expand Up @@ -101,9 +97,6 @@ class CardHtml(
private fun getContent(): String {
var content = context.expandSounds(beforeSoundTemplateExpansion)
content = CardAppearance.fixBoldStyle(content)
if (nightModeInversion) {
return HtmlColors.invertColors(content)
}
return content
}

Expand Down Expand Up @@ -133,8 +126,6 @@ class CardHtml(
fun createInstance(card: Card, side: Side, context: HtmlGenerator): CardHtml {
val content = displayString(card, side, context)

val nightModeInversion = currentTheme.isNightMode && !hasUserDefinedNightMode(card)

val renderOutput = card.renderOutput()
val questionAv = renderOutput.questionAvTags
val answerAv = renderOutput.answerAvTags
Expand All @@ -145,7 +136,7 @@ class CardHtml(
// legacy (slow) function to return the answer without the front side
fun getAnswerWithoutFrontSideLegacy(): String = removeFrontSideAudio(card, card.answer())

return CardHtml(content, card.ord, nightModeInversion, context, side, ::getAnswerWithoutFrontSideLegacy, questionSound, answerSound)
return CardHtml(content, card.ord, context, side, ::getAnswerWithoutFrontSideLegacy, questionSound, answerSound)
}

/**
Expand Down
267 changes: 0 additions & 267 deletions AnkiDroid/src/main/java/com/ichi2/themes/HtmlColors.kt

This file was deleted.

This file was deleted.

Loading

0 comments on commit dc45c0d

Please sign in to comment.