aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-21 23:07:20 -0500
committerGitHub <noreply@github.com>2017-12-21 23:07:20 -0500
commitbd99aebf4388515273dfd720eb5c59b6e45da44f (patch)
treec19d8efdcd6500c43e3fa16d51f581bd72e753f5 /app/src/main/kotlin/com
parentf1e1aec8487fd148eb8e75fe016a8438958989ad (diff)
downloadfrost-bd99aebf4388515273dfd720eb5c59b6e45da44f.tar.gz
frost-bd99aebf4388515273dfd720eb5c59b6e45da44f.tar.bz2
frost-bd99aebf4388515273dfd720eb5c59b6e45da44f.zip
Update themes (#569)
* Update themes * Update changelog
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt22
1 files changed, 13 insertions, 9 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 d9542cba..cd13eede 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -6,6 +6,7 @@ import ca.allanwang.kau.kotlin.lazyContext
import ca.allanwang.kau.utils.*
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
+import java.io.BufferedReader
import java.io.FileNotFoundException
import java.util.*
@@ -21,24 +22,27 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract {
var file = "${name.toLowerCase(Locale.CANADA)}.css"
var injector = lazyContext {
try {
- var content = it.assets.open("css/$folder/$file").bufferedReader().use { it.readText() }
+ var content = it.assets.open("css/$folder/$file").bufferedReader().use(BufferedReader::readText)
if (this == CUSTOM) {
- val bt: String
- if (Color.alpha(Prefs.bgColor) == 255) {
- bt = Prefs.bgColor.toRgbaString()
- } else {
- bt = "transparent"
- }
+ val bt = if (Color.alpha(Prefs.bgColor) == 255)
+ Prefs.bgColor.toRgbaString()
+ else
+ "transparent"
+
+ val bb = Prefs.bgColor.colorToForeground(0.35f)
+
content = content
.replace("\$T\$", Prefs.textColor.toRgbaString())
.replace("\$TT\$", Prefs.textColor.colorToBackground(0.05f).toRgbaString())
.replace("\$A\$", Prefs.accentColor.toRgbaString())
.replace("\$B\$", Prefs.bgColor.toRgbaString())
.replace("\$BT\$", bt)
- .replace("\$BBT\$", Prefs.bgColor.withAlpha(51).colorToForeground(0.35f).toRgbaString())
+ .replace("\$BBT\$", bb.withAlpha(51).toRgbaString())
.replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString())
- .replace("\$OO\$", Prefs.bgColor.withAlpha(255).colorToForeground(0.35f).toRgbaString())
+ .replace("\$OO\$", bb.withAlpha(255).toRgbaString())
.replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString())
+ .replace("\$TI\$", bb.withAlpha(60).toRgbaString())
+ .replace("\$C\$", bt)
}
JsBuilder().css(content).build()
} catch (e: FileNotFoundException) {