mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
feat: custom Gradient theme with primary and secondary colors (#1309)
* feat: a custom Gradient theme with a primary and a secondary colour, picked with a wheel, sliders and a hex box * Gradient theme: OK waits for a valid hex, deep blues are made paler, button text suits the worse gradient colour * Gradient theme: nudge only the gradient colour that button text cannot read on * fix: meet readable contrast across gradient themes * fix: preserve contrast through gradient interpolation --------- Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com>
This commit is contained in:
1 parent
d2abaef2a3
commit
7482f797c7
43 files changed
+789
-5
No files matched your search
@@ -759,6 +759,16 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("theme", id).apply()
|
||||
}
|
||||
|
||||
/** The custom Gradient theme's primary and secondary colours (ARGB). */
|
||||
fun gradientColors(context: Context): Pair<Int, Int> = prefs(context).let {
|
||||
it.getInt("gradientPrimary", com.droiddeck.launcher.ui.Themes.DEFAULT_PRIMARY) to
|
||||
it.getInt("gradientSecondary", com.droiddeck.launcher.ui.Themes.DEFAULT_SECONDARY)
|
||||
}
|
||||
|
||||
fun setGradientColors(context: Context, primary: Int, secondary: Int) {
|
||||
prefs(context).edit().putInt("gradientPrimary", primary).putInt("gradientSecondary", secondary).apply()
|
||||
}
|
||||
|
||||
private fun customResolution(context: Context, mode: String): Pair<Int, Int>? =
|
||||
parseResolution(prefs(context).getString("customRes.$mode", null))
|
||||
|
||||
|
||||
Reference in new issue
Block a user