aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-30 20:46:54 -0700
committerAllan Wang <me@allanwang.ca>2017-06-30 20:46:54 -0700
commitf6ae04c42c7e2fabcd4de10290d7e6b5ea83b368 (patch)
tree025d4ecd92a864ac9b07ceb0e005e208244864e0 /app/src/main/kotlin/com/pitchedapps
parenta5ea70cd8fbc1f4fb15742d810698a7caef0eb26 (diff)
downloadfrost-f6ae04c42c7e2fabcd4de10290d7e6b5ea83b368.tar.gz
frost-f6ae04c42c7e2fabcd4de10290d7e6b5ea83b368.tar.bz2
frost-f6ae04c42c7e2fabcd4de10290d7e6b5ea83b368.zip
Mimic template themes when opaque
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
index 47f7d325..35acdcb3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -1,8 +1,8 @@
package com.pitchedapps.frost.injectors
+import android.graphics.Color
import android.webkit.WebView
import ca.allanwang.kau.utils.*
-import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
/**
@@ -21,11 +21,21 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract {
if (injector == null) {
var content = webView.context.assets.open("css/$folder/$file").bufferedReader().use { it.readText() }
if (this == CUSTOM) {
+ var bbt = Prefs.bgColor
+ val bt: String
+ if (Color.alpha(bbt) == 255) {
+ bbt = bbt.adjustAlpha(0.2f).colorToForeground(0.35f)
+ bt = Prefs.bgColor.toRgbaString()
+ } else {
+ bbt = bbt.adjustAlpha(0.05f).colorToForeground(0.5f)
+ bt = "transparent"
+ }
content = content
.replace("\$T\$", Prefs.textColor.toRgbaString())
.replace("\$TT\$", Prefs.textColor.colorToBackground(0.05f).toRgbaString())
.replace("\$B\$", Prefs.bgColor.toRgbaString())
- .replace("\$BBT\$", Prefs.bgColor.adjustAlpha(0.2f).colorToForeground(0.35f).toRgbaString())
+ .replace("\$BT\$", bt)
+ .replace("\$BBT\$", bbt.toRgbaString())
.replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString())
.replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString())
}