From f6ae04c42c7e2fabcd4de10290d7e6b5ea83b368 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 30 Jun 2017 20:46:54 -0700 Subject: Mimic template themes when opaque --- .idea/misc.xml | 2 +- app/build.gradle | 2 +- app/src/main/assets/css/themes/custom.compact.css | 6 +++--- app/src/main/assets/css/themes/custom.scss | 2 +- .../kotlin/com/pitchedapps/frost/injectors/CssAssets.kt | 14 ++++++++++++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 7319f021..085136f8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -53,7 +53,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 041ee3c1..89e3abaa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -120,7 +120,7 @@ dependencies { kapt "nz.bradcampbell:paperparcel-compiler:${PAPER_PARCEL}" compile "com.jude:swipebackhelper:${SWIPE_BACK}" - + compile("com.crashlytics.sdk.android:crashlytics:${CRASHLYTICS}@aar") { transitive = true; } diff --git a/app/src/main/assets/css/themes/custom.compact.css b/app/src/main/assets/css/themes/custom.compact.css index e02cfe08..df7c449d 100644 --- a/app/src/main/assets/css/themes/custom.compact.css +++ b/app/src/main/assets/css/themes/custom.compact.css @@ -1,8 +1,8 @@ #viewport { background: $B$ !important; } -body, #root, #header, [style*="background-color"], ._55wo, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5lp5, .container, .subpage, ._5n_f, #static_templates, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, .al, ._1gkq, ._5c5b, ._1qxg, ._5luf, ._2new, ._11ub, ._5p7j, ._55wm, ._5rgs, ._5xuj, ._1sv1, ._45fu, ._18qg, ._1_ac, ._5w3g, ._3e18, ._10c_, ._2jl2, ._5q_r, ._5yt8, ._idb, ._2ip_, ._d4i, ._577z, ._2u4w, ._3u9p, ._3u9t, ._2v9s, ._cw4, ._5_y-, ._5_y_, ._5_z3, ._cwy, ._5_z0, ._5_z1, ._5_z2, ._2mtc, ._206a, ._1_-1, ._1ybg, .appCenterCategorySelectorButton, ._5c9u, div._5y57::before, ._59f6._55so::before, .structuredPublisher, ._94v, ._vqv, ._5lp5, ._55wm, ._2om3, ._2ol-, ._1f9d, ._vee, ._31a-, ._3r8b, ._3r9d, .acw, ._4_xl, ._1p70, ._1p70, ._1ih_, ._51v6, ._u2c, ._484w, ._3ils, ._rm7, ._32qk, ._d01, ._2y60, ._5fu3, ._2foa, ._2y5_, ._38o9, ._1kb, .mAppCenterFatLabel, ._3f50, .mentions-placeholder, .mentions, .mentions-shadow, .mentions-measurer, .acg, ._59tu, ._52z5, ._4l9b, ._4gj3, .groupChromeView, ._uww, textarea, ._15n_, ._skt, ._5f28, ._14_j, ._3bg5, ._53_-, ._52x1 { background: transparent !important; } +body, #root, #header, [style*="background-color"], ._55wo, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5lp5, .container, .subpage, ._5n_f, #static_templates, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, .al, ._1gkq, ._5c5b, ._1qxg, ._5luf, ._2new, ._11ub, ._5p7j, ._55wm, ._5rgs, ._5xuj, ._1sv1, ._45fu, ._18qg, ._1_ac, ._5w3g, ._3e18, ._10c_, ._2jl2, ._5q_r, ._5yt8, ._idb, ._2ip_, ._d4i, ._577z, ._2u4w, ._3u9p, ._3u9t, ._2v9s, ._cw4, ._5_y-, ._5_y_, ._5_z3, ._cwy, ._5_z0, ._5_z1, ._5_z2, ._2mtc, ._206a, ._1_-1, ._1ybg, .appCenterCategorySelectorButton, ._5c9u, div._5y57::before, ._59f6._55so::before, .structuredPublisher, ._94v, ._vqv, ._5lp5, ._55wm, ._2om3, ._2ol-, ._1f9d, ._vee, ._31a-, ._3r8b, ._3r9d, .acw, ._4_xl, ._1p70, ._1p70, ._1ih_, ._51v6, ._u2c, ._484w, ._3ils, ._rm7, ._32qk, ._d01, ._2y60, ._5fu3, ._2foa, ._2y5_, ._38o9, ._1kb, .mAppCenterFatLabel, ._3f50, .mentions-placeholder, .mentions, .mentions-shadow, .mentions-measurer, .acg, ._59tu, ._52z5, ._4l9b, ._4gj3, .groupChromeView, ._uww, textarea, ._15n_, ._skt, ._5f28, ._14_j, ._3bg5, ._53_-, ._52x1 { background: $BT$ !important; } -._cv_, ._2sq8 { background-color: transparent !important; } +._cv_, ._2sq8 { background-color: $BT$ !important; } .jewel, .flyout, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p { background: $O$ !important; } @@ -30,7 +30,7 @@ button, button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._ [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] { display: none !important; } -._2cis { border-left: 10px solid transparent !important; border-right: 10px solid transparent !important; } +._2cis { border-left: 10px solid $BT$ !important; border-right: 10px solid $BT$ !important; } ._2cir.selected { border-bottom: 3px solid $T$ !important; } diff --git a/app/src/main/assets/css/themes/custom.scss b/app/src/main/assets/css/themes/custom.scss index 1a3013a9..307fe815 100644 --- a/app/src/main/assets/css/themes/custom.scss +++ b/app/src/main/assets/css/themes/custom.scss @@ -1,4 +1,4 @@ -$bg_transparent: transparent; +$bg_transparent: unquote('$BT$'); $text: unquote('$T$'); $link: unquote('$TT$'); $background: unquote('$B$'); 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()) } -- cgit v1.2.3