diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index 3e37adb58e..5c9d0eb178 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -1534,6 +1534,45 @@ object SessionPrefs { prefs(context).edit().putInt("gradientPrimary", primary).putInt("gradientSecondary", secondary).apply() } + fun customThemeColors(context: Context): com.droiddeck.launcher.ui.CustomThemeColors = + prefs(context).let { p -> + val defaults = com.droiddeck.launcher.ui.CustomThemeColors() + com.droiddeck.launcher.ui.CustomThemeColors( + background = p.getInt("customThemeBackground", defaults.background), + surface = p.getInt("customThemeSurface", defaults.surface), + surfaceVariant = p.getInt("customThemeSurfaceVariant", defaults.surfaceVariant), + line = p.getInt("customThemeLine", defaults.line), + line2 = p.getInt("customThemeLine2", defaults.line2), + onBackground = p.getInt("customThemeOnBackground", defaults.onBackground), + onSurfaceVariant = p.getInt("customThemeOnSurfaceVariant", defaults.onSurfaceVariant), + primary = p.getInt("customThemePrimary", defaults.primary), + onPrimary = p.getInt("customThemeOnPrimary", defaults.onPrimary), + signal = p.getInt("customThemeSignal", defaults.signal), + good = p.getInt("customThemeGood", defaults.good), + error = p.getInt("customThemeError", defaults.error), + ) + } + + fun setCustomThemeColors( + context: Context, + colors: com.droiddeck.launcher.ui.CustomThemeColors, + ) { + prefs(context).edit() + .putInt("customThemeBackground", colors.background) + .putInt("customThemeSurface", colors.surface) + .putInt("customThemeSurfaceVariant", colors.surfaceVariant) + .putInt("customThemeLine", colors.line) + .putInt("customThemeLine2", colors.line2) + .putInt("customThemeOnBackground", colors.onBackground) + .putInt("customThemeOnSurfaceVariant", colors.onSurfaceVariant) + .putInt("customThemePrimary", colors.primary) + .putInt("customThemeOnPrimary", colors.onPrimary) + .putInt("customThemeSignal", colors.signal) + .putInt("customThemeGood", colors.good) + .putInt("customThemeError", colors.error) + .apply() + } + fun trueBlackHighlight(context: Context): Int = prefs(context).getInt("trueBlackHighlight", com.droiddeck.launcher.ui.Themes.DEFAULT_HIGHLIGHT) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt index 9f457566bb..8815ea43ac 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt @@ -437,6 +437,7 @@ internal fun SetupPanel( } if (s.theme == Themes.INNER_GAMER) RgbSpeedRow() if (s.theme == Themes.GRADIENT) GradientColorRows() + if (s.theme == Themes.CUSTOM) CustomColorRows() if (s.theme == Themes.TRUE_BLACK) HighlightColorRow() ChoiceRow( host, "app-scale", stringResource(R.string.setup_app_scale), stringResource(R.string.setup_app_scale_hint), @@ -1212,3 +1213,42 @@ private fun GradientColorRows() { if (picking == 1) Themes.setGradient(ctx, argb, secondary) else Themes.setGradient(ctx, primary, argb) } } + +@Composable +private fun CustomColorRows() { + val ctx = androidx.compose.ui.platform.LocalContext.current.applicationContext + val colors = Themes.customColors + var picking by remember { mutableStateOf(null) } + + val rows = listOf( + Triple("background", stringResource(R.string.theme_custom_background), colors.background), + Triple("surface", stringResource(R.string.theme_custom_surface), colors.surface), + Triple("surfaceVariant", stringResource(R.string.theme_custom_surface_variant), colors.surfaceVariant), + Triple("line", stringResource(R.string.theme_custom_line), colors.line), + Triple("line2", stringResource(R.string.theme_custom_line2), colors.line2), + Triple("onBackground", stringResource(R.string.theme_custom_on_background), colors.onBackground), + Triple("onSurfaceVariant", stringResource(R.string.theme_custom_on_surface_variant), colors.onSurfaceVariant), + Triple("primary", stringResource(R.string.theme_custom_primary), colors.primary), + Triple("onPrimary", stringResource(R.string.theme_custom_on_primary), colors.onPrimary), + Triple("signal", stringResource(R.string.theme_custom_signal), colors.signal), + Triple("good", stringResource(R.string.theme_custom_good), colors.good), + Triple("error", stringResource(R.string.theme_custom_error), colors.error), + ) + + rows.forEach { (key, label, argb) -> + SettingsRow(label, null) { + ColorCube(Color(argb), label) { picking = key } + } + } + + val selected = rows.firstOrNull { it.first == picking } + if (selected != null) { + ColorPickerDialog( + selected.second, + selected.third, + onDismiss = { picking = null }, + ) { argb -> + Themes.setCustomColor(ctx, selected.first, argb) + } + } +} diff --git a/app/src/main/java/com/droiddeck/launcher/ui/Theme.kt b/app/src/main/java/com/droiddeck/launcher/ui/Theme.kt index 6b4dd7d99a..8cf7013d0f 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/Theme.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/Theme.kt @@ -41,6 +41,21 @@ class Palette( val good: Color, val error: Color = Color(0xFFFF8A80), ) +data class CustomThemeColors( + val background: Int = 0xFF0A0B0D.toInt(), + val surface: Int = 0xFF121417.toInt(), + val surfaceVariant: Int = 0xFF1A1D22.toInt(), + val line: Int = 0xFF262A31.toInt(), + val line2: Int = 0xFF343A43.toInt(), + val onBackground: Int = 0xFFF2F4F7.toInt(), + val onSurfaceVariant: Int = 0xFF9AA3AF.toInt(), + val primary: Int = 0xFF1A9FFF.toInt(), + val onPrimary: Int = 0xFF03111F.toInt(), + val signal: Int = 0xFF1A9FFF.toInt(), + val good: Int = 0xFF4CD37F.toInt(), + val error: Int = 0xFFFF8A80.toInt(), +) + object Themes { const val GRAPHITE = "graphite" const val PAPER = "paper" @@ -48,6 +63,7 @@ object Themes { const val ELECTRIC = "electric" const val INNER_GAMER = "inner_gamer" const val GRADIENT = "gradient" + const val CUSTOM = "custom" const val DEFAULT_PRIMARY = 0xFF8B5CF6.toInt() const val DEFAULT_SECONDARY = 0xFF22D3EE.toInt() @@ -55,6 +71,9 @@ object Themes { var gradientColors by mutableStateOf(DEFAULT_PRIMARY to DEFAULT_SECONDARY) private set + var customColors by mutableStateOf(CustomThemeColors()) + private set + const val RGB_SPEEDS = 10 const val DEFAULT_RGB_SPEED = 3 const val RGB_HUE_STEP = 3f @@ -87,6 +106,7 @@ object Themes { gradientColors = SessionPrefs.gradientColors(context) rgbSpeed = SessionPrefs.rgbSpeed(context) trueBlackHighlight = SessionPrefs.trueBlackHighlight(context) + customColors = SessionPrefs.customThemeColors(context) } fun setTrueBlackHighlight(context: Context, highlight: Int) { @@ -104,9 +124,51 @@ object Themes { gradientColors = primary to secondary } + fun setCustomColors(context: Context, colors: CustomThemeColors) { + SessionPrefs.setCustomThemeColors(context, colors) + customColors = colors + } + + fun setCustomColor(context: Context, key: String, color: Int) { + val current = customColors + val updated = when (key) { + "background" -> current.copy(background = color) + "surface" -> current.copy(surface = color) + "surfaceVariant" -> current.copy(surfaceVariant = color) + "line" -> current.copy(line = color) + "line2" -> current.copy(line2 = color) + "onBackground" -> current.copy(onBackground = color) + "onSurfaceVariant" -> current.copy(onSurfaceVariant = color) + "primary" -> current.copy(primary = color) + "onPrimary" -> current.copy(onPrimary = color) + "signal" -> current.copy(signal = color) + "good" -> current.copy(good = color) + "error" -> current.copy(error = color) + else -> return + } + setCustomColors(context, updated) + } + + private fun customPalette(colors: CustomThemeColors): Palette = Palette( + CUSTOM, R.string.theme_custom, R.string.theme_custom_detail, + background = Color(colors.background), + surface = Color(colors.surface), + surfaceVariant = Color(colors.surfaceVariant), + line = Color(colors.line), + line2 = Color(colors.line2), + onBackground = Color(colors.onBackground), + onSurfaceVariant = Color(colors.onSurfaceVariant), + primary = Color(colors.primary), + primary2 = Color(colors.primary), + onPrimary = Color(colors.onPrimary), + signal = Color(colors.signal), + good = Color(colors.good), + error = Color(colors.error), + ) + fun current(context: Context): Palette { val id = SessionPrefs.theme(context) - if (id == GRADIENT || id == INNER_GAMER || id == TRUE_BLACK) loadGradient(context) + if (id == GRADIENT || id == INNER_GAMER || id == TRUE_BLACK || id == CUSTOM) loadGradient(context) return byId(id) } @@ -149,11 +211,13 @@ object Themes { ), innerGamer(0f), ThemeColors.palette(DEFAULT_PRIMARY, DEFAULT_SECONDARY, R.string.theme_gradient, R.string.theme_gradient_detail), + customPalette(customColors), ) fun byId(id: String): Palette { if (id == INNER_GAMER) return innerGamer(rgbHue) if (id == TRUE_BLACK) return ThemeColors.trueBlack(trueBlackHighlight) + if (id == CUSTOM) return customPalette(customColors) if (id == GRADIENT) return ThemeColors.palette(gradientColors.first, gradientColors.second, R.string.theme_gradient, R.string.theme_gradient_detail) return all.firstOrNull { it.id == id } ?: all[0] } @@ -203,7 +267,6 @@ private val ContentDirected = Typography().run { @Composable private fun InnerGamerHue(speed: Int) { - if (Motion.scale == 0f) return key(speed) { InnerGamerCycle(speed) } } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 9522e44de5..dc432165d9 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -4262,4 +4262,18 @@ عدد صحيح ملاءمة تنعيم الحواف + مخصص + اختر كل لون في الواجهة بشكل مستقل. + الخلفية + اللوحات + اللوحات المرتفعة + الفواصل + الحدود + النص الرئيسي + النص الثانوي + الأزرار واللون الأساسي + نص الأزرار + الإبرازات + نجاح + خطأ \ No newline at end of file diff --git a/app/src/main/res/values-b+es+419/strings.xml b/app/src/main/res/values-b+es+419/strings.xml index 1582f3c19e..e6b952e051 100644 --- a/app/src/main/res/values-b+es+419/strings.xml +++ b/app/src/main/res/values-b+es+419/strings.xml @@ -4142,4 +4142,18 @@ Entero Ajustar Antialiasing + Personalizado + Elige cada color de la interfaz por separado. + Fondo + Paneles + Paneles elevados + Separadores + Bordes + Texto principal + Texto secundario + Botones y color principal + Texto de los botones + Destacados + Éxito + Error \ No newline at end of file diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 9b6629c979..68e8f04c51 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -4102,4 +4102,18 @@ Цяло число Побиране Заглаждане на ръбовете + Персонализирана + Изберете поотделно всеки цвят на интерфейса. + Фон + Панели + Повдигнати панели + Разделители + Рамки + Основен текст + Вторичен текст + Бутони и основен акцент + Текст на бутоните + Акценти + Успех + Грешка \ No newline at end of file diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 7c2f59aee2..9adcee02c7 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -4182,4 +4182,18 @@ Celé číslo Přizpůsobit Vyhlazování hran + Vlastní + Vyberte samostatně každou barvu rozhraní. + Pozadí + Panely + Vyvýšené panely + Oddělovače + Ohraničení + Hlavní text + Vedlejší text + Tlačítka a hlavní zvýraznění + Text tlačítek + Zvýraznění + Úspěch + Chyba \ No newline at end of file diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index f86af3f9b8..e46157c608 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -4102,4 +4102,18 @@ Heltal Tilpas Kantudjævning + Tilpasset + Vælg hver grænsefladefarve individuelt. + Baggrund + Paneler + Hævede paneler + Skillestreger + Kanter + Primær tekst + Sekundær tekst + Knapper og hovedaccent + Knaptekst + Fremhævninger + Succes + Fejl \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2deaec9777..c3d3db896f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -4102,4 +4102,18 @@ Ganzzahlig Anpassen Kantenglättung + Benutzerdefiniert + Wähle jede Farbe der Oberfläche einzeln aus. + Hintergrund + Flächen + Erhöhte Flächen + Trennlinien + Rahmen + Haupttext + Sekundärtext + Schaltflächen und Hauptakzent + Schaltflächentext + Hervorhebungen + Erfolg + Fehler \ No newline at end of file diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 43d687e021..1c4e366e1c 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -4102,4 +4102,18 @@ Ακέραιος Προσαρμογή Εξομάλυνση ακμών + Προσαρμοσμένο + Επιλέξτε ξεχωριστά κάθε χρώμα της διεπαφής. + Φόντο + Πλαίσια + Ανυψωμένα πλαίσια + Διαχωριστικά + Περιγράμματα + Κύριο κείμενο + Δευτερεύον κείμενο + Κουμπιά και κύριο χρώμα έμφασης + Κείμενο κουμπιών + Επισημάνσεις + Επιτυχία + Σφάλμα \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 4a41370327..bd4fddf71d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -4142,4 +4142,18 @@ Entero Ajustar Suavizado de bordes + Personalizado + Elige cada color de la interfaz por separado. + Fondo + Paneles + Paneles elevados + Separadores + Bordes + Texto principal + Texto secundario + Botones y color principal + Texto de los botones + Destacados + Éxito + Error \ No newline at end of file diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 0e9ef5f069..5bb3bd1af5 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -4102,4 +4102,18 @@ Kokonaisluku Sovita Reunanpehmennys + Mukautettu + Valitse käyttöliittymän jokainen väri erikseen. + Tausta + Paneelit + Korotetut paneelit + Erottimet + Reunat + Pääteksti + Toissijainen teksti + Painikkeet ja pääkorostus + Painikkeiden teksti + Korostukset + Onnistuminen + Virhe \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a40f61aed9..1177bfc170 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4141,4 +4141,18 @@ Entier Ajuster Anticrénelage + Personnalisé + Choisissez séparément chaque couleur de l’interface. + Arrière-plan + Panneaux + Panneaux surélevés + Séparateurs + Bordures + Texte principal + Texte secondaire + Boutons et accent principal + Texte des boutons + Mises en évidence + Succès + Erreur \ No newline at end of file diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 9ffe130bc8..c92d69ca9f 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -4102,4 +4102,18 @@ पूर्णांक फ़िट एंटी-अलियासिंग + कस्टम + इंटरफ़ेस का हर रंग अलग-अलग चुनें। + पृष्ठभूमि + पैनल + उभरे हुए पैनल + विभाजक + किनारे + मुख्य टेक्स्ट + द्वितीयक टेक्स्ट + बटन और मुख्य हाइलाइट + बटन का टेक्स्ट + हाइलाइट + सफलता + त्रुटि \ No newline at end of file diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index dbacff4fc5..301db987d2 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -4102,4 +4102,18 @@ Egész szám Igazítás Élsimítás + Egyéni + Válaszd ki külön a felület minden színét. + Háttér + Panelek + Kiemelt panelek + Elválasztók + Szegélyek + Fő szöveg + Másodlagos szöveg + Gombok és fő kiemelés + Gombok szövege + Kiemelések + Siker + Hiba \ No newline at end of file diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index d57f4fce8a..29598f3980 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -4072,4 +4072,18 @@ Bilangan bulat Sesuaikan Anti-aliasing + Kustom + Pilih setiap warna antarmuka secara terpisah. + Latar belakang + Panel + Panel terangkat + Pemisah + Batas + Teks utama + Teks sekunder + Tombol dan aksen utama + Teks tombol + Sorotan + Berhasil + Kesalahan \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 9762487af7..7b4d3f2870 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -4141,4 +4141,18 @@ Intero Adatta Antialiasing + Personalizzato + Scegli separatamente ogni colore dell’interfaccia. + Sfondo + Pannelli + Pannelli rialzati + Separatori + Bordi + Testo principale + Testo secondario + Pulsanti e colore principale + Testo dei pulsanti + Evidenziazioni + Successo + Errore \ No newline at end of file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4368eb3b77..e5cdba2950 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -4072,4 +4072,18 @@ 整数 画面に合わせる アンチエイリアス + カスタム + インターフェースの各色を個別に選択します。 + 背景 + パネル + 浮き上がったパネル + 区切り線 + 境界線 + メインテキスト + サブテキスト + ボタンとメインアクセント + ボタンのテキスト + 強調表示 + 成功 + エラー \ No newline at end of file diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 65be1ca189..536d332105 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -4072,4 +4072,18 @@ 정수 화면에 맞춤 안티앨리어싱 + 사용자 지정 + 인터페이스의 각 색상을 개별적으로 선택하세요. + 배경 + 패널 + 돌출 패널 + 구분선 + 테두리 + 기본 텍스트 + 보조 텍스트 + 버튼 및 기본 강조색 + 버튼 텍스트 + 강조 표시 + 성공 + 오류 \ No newline at end of file diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index 35583d3e7b..bcc31c2f02 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -4072,4 +4072,18 @@ Integer Muat Anti-aliasing + Tersuai + Pilih setiap warna antara muka secara berasingan. + Latar belakang + Panel + Panel timbul + Pemisah + Sempadan + Teks utama + Teks sekunder + Butang dan aksen utama + Teks butang + Sorotan + Berjaya + Ralat \ No newline at end of file diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index f503b384b0..2c1878427c 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -4102,4 +4102,18 @@ Heltall Tilpass Kantutjevning + Egendefinert + Velg hver grensesnittfarge individuelt. + Bakgrunn + Paneler + Hevede paneler + Skillelinjer + Kanter + Hovedtekst + Sekundærtekst + Knapper og hovedfarge + Knappetekst + Uthevinger + Suksess + Feil \ No newline at end of file diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f505680b3d..8134e019ed 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -4102,4 +4102,18 @@ Geheel getal Passend Anti-aliasing + Aangepast + Kies elke interfacekleur afzonderlijk. + Achtergrond + Panelen + Verhoogde panelen + Scheidingslijnen + Randen + Hoofdtekst + Secundaire tekst + Knoppen en hoofdkleur + Knoptekst + Accenten + Geslaagd + Fout \ No newline at end of file diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index db86d683b7..6bae94dd48 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -4182,4 +4182,18 @@ Liczba całkowita Dopasuj Wygładzanie krawędzi + Niestandardowy + Wybierz osobno każdy kolor interfejsu. + Tło + Panele + Wyniesione panele + Separatory + Obramowania + Tekst główny + Tekst dodatkowy + Przyciski i główny akcent + Tekst przycisków + Wyróżnienia + Sukces + Błąd \ No newline at end of file diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 855d84d3cd..bda1ae5614 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -1842,6 +1842,20 @@ Saturação Brilho Cor hexadecimal + Personalizado + Escolha individualmente cada cor da interface. + Fundo + Painéis + Painéis elevados + Divisórias + Contornos + Texto principal + Texto secundário + Botões e destaque principal + Texto dos botões + Destaques e indicadores + Sucesso + Erro Esc Ins Del diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 46df26d466..e49853cb6a 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1850,6 +1850,20 @@ Saturação Brilho Cor hexadecimal + Personalizado + Escolha individualmente cada cor da interface. + Fundo + Painéis + Painéis elevados + Divisórias + Bordas + Texto principal + Texto secundário + Botões e destaque principal + Texto dos botões + Destaques e indicadores + Sucesso + Erro Esc Ins Del diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index bea73bdabc..940364de71 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -4142,4 +4142,18 @@ Număr întreg Potrivire Antialiasing + Personalizat + Alege separat fiecare culoare a interfeței. + Fundal + Panouri + Panouri ridicate + Separatoare + Margini + Text principal + Text secundar + Butoane și accent principal + Textul butoanelor + Evidențieri + Succes + Eroare \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f03f4b301b..2673ee7ccd 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -4182,4 +4182,18 @@ Целое число По размеру Сглаживание + Пользовательская + Выберите каждый цвет интерфейса отдельно. + Фон + Панели + Приподнятые панели + Разделители + Границы + Основной текст + Вторичный текст + Кнопки и основной акцент + Текст кнопок + Выделения + Успех + Ошибка \ No newline at end of file diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 0db21cecce..8e169e62a2 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -4102,4 +4102,18 @@ Heltal Anpassa Kantutjämning + Anpassat + Välj varje gränssnittsfärg separat. + Bakgrund + Paneler + Upphöjda paneler + Avdelare + Kanter + Huvudtext + Sekundär text + Knappar och huvudaccent + Knapptext + Markeringar + Lyckades + Fel \ No newline at end of file diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 902fbb36b7..243108da7f 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -4072,4 +4072,18 @@ จำนวนเต็ม พอดีหน้าจอ การลบรอยหยัก + กำหนดเอง + เลือกสีแต่ละสีของอินเทอร์เฟซแยกกัน + พื้นหลัง + แผง + แผงยกสูง + ตัวแบ่ง + เส้นขอบ + ข้อความหลัก + ข้อความรอง + ปุ่มและสีเน้นหลัก + ข้อความบนปุ่ม + จุดเน้น + สำเร็จ + ข้อผิดพลาด \ No newline at end of file diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 9569a8ccdc..25944dc95e 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -4102,4 +4102,18 @@ Tam sayı Sığdır Kenar yumuşatma + Özel + Arayüzdeki her rengi ayrı ayrı seçin. + Arka plan + Paneller + Yükseltilmiş paneller + Ayırıcılar + Kenarlıklar + Ana metin + İkincil metin + Düğmeler ve ana vurgu + Düğme metni + Vurgular + Başarılı + Hata \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index a0cd852b61..55bd3196c9 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -4182,4 +4182,18 @@ Ціле число За розміром Згладжування + Власна тема + Виберіть окремо кожен колір інтерфейсу. + Тло + Панелі + Підняті панелі + Роздільники + Межі + Основний текст + Вторинний текст + Кнопки й основний акцент + Текст кнопок + Виділення + Успіх + Помилка \ No newline at end of file diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index a5cf10eab6..347822317f 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -4072,4 +4072,18 @@ Số nguyên Vừa màn hình Khử răng cưa + Tùy chỉnh + Chọn riêng từng màu của giao diện. + Nền + Bảng + Bảng nổi + Đường phân cách + Đường viền + Văn bản chính + Văn bản phụ + Nút và màu nhấn chính + Văn bản trên nút + Điểm nhấn + Thành công + Lỗi \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0ba97dd1ff..2ece3be681 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -4072,4 +4072,18 @@ 整数 适应 抗锯齿 + 自定义 + 分别选择界面的每种颜色。 + 背景 + 面板 + 凸起面板 + 分隔线 + 边框 + 主要文本 + 次要文本 + 按钮和主要强调色 + 按钮文字 + 高亮 + 成功 + 错误 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 083c591954..8ba6d09f98 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -4072,4 +4072,18 @@ 整數 配合畫面 抗鋸齒 + 自訂 + 分別選擇介面的每種顏色。 + 背景 + 面板 + 凸起面板 + 分隔線 + 邊框 + 主要文字 + 次要文字 + 按鈕和主要強調色 + 按鈕文字 + 重點標示 + 成功 + 錯誤 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 12fa80e1ef..dfb1bc732d 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -4072,4 +4072,18 @@ 整數 符合畫面 抗鋸齒 + 自訂 + 分別選擇介面的每種顏色。 + 背景 + 面板 + 浮起面板 + 分隔線 + 邊框 + 主要文字 + 次要文字 + 按鈕與主要強調色 + 按鈕文字 + 醒目標示 + 成功 + 錯誤 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29e4d9428b..05a387b644 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2039,6 +2039,20 @@ Saturation Brightness Hex color + Custom + Choose each interface color independently. + Background + Panels + Raised panels + Dividers + Borders + Main text + Secondary text + Buttons and main accent + Button text + Highlights + Success + Error Esc Ins Del diff --git a/app/src/test/java/com/droiddeck/launcher/ui/ThemeColorsTest.kt b/app/src/test/java/com/droiddeck/launcher/ui/ThemeColorsTest.kt index 2f2cc3cd3b..b98d0f1eea 100644 --- a/app/src/test/java/com/droiddeck/launcher/ui/ThemeColorsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/ui/ThemeColorsTest.kt @@ -188,4 +188,45 @@ class ThemeColorsTest { SessionPrefs.setTheme(app, Themes.TRUE_BLACK) assertEquals(Color(0xFFFF8800), Themes.current(app).primary) } + + @Test fun customThemeRestoresIndependentColorsAndUsesASolidAccent() { + val chosen = CustomThemeColors( + background = 0xFF101112.toInt(), + surface = 0xFF202122.toInt(), + surfaceVariant = 0xFF303132.toInt(), + line = 0xFF404142.toInt(), + line2 = 0xFF505152.toInt(), + onBackground = 0xFFF1F2F3.toInt(), + onSurfaceVariant = 0xFFD1D2D3.toInt(), + primary = 0xFF336699.toInt(), + onPrimary = 0xFFFFFFFF.toInt(), + signal = 0xFFFFAA00.toInt(), + good = 0xFF00CC66.toInt(), + error = 0xFFFF4433.toInt(), + ) + + Themes.setCustomColors(app, CustomThemeColors()) + SessionPrefs.setCustomThemeColors(app, chosen) + SessionPrefs.setTheme(app, Themes.CUSTOM) + + assertEquals(chosen, SessionPrefs.customThemeColors(app)) + + val palette = Themes.current(app) + assertEquals(Themes.CUSTOM, palette.id) + assertEquals(Color(chosen.background), palette.background) + assertEquals(Color(chosen.surface), palette.surface) + assertEquals(Color(chosen.surfaceVariant), palette.surfaceVariant) + assertEquals(Color(chosen.line), palette.line) + assertEquals(Color(chosen.line2), palette.line2) + assertEquals(Color(chosen.onBackground), palette.onBackground) + assertEquals(Color(chosen.onSurfaceVariant), palette.onSurfaceVariant) + assertEquals(Color(chosen.primary), palette.primary) + assertEquals(Color(chosen.primary), palette.primary2) + assertEquals(Color(chosen.onPrimary), palette.onPrimary) + assertEquals(Color(chosen.signal), palette.signal) + assertEquals(Color(chosen.good), palette.good) + assertEquals(Color(chosen.error), palette.error) + assertTrue(Themes.all.any { it.id == Themes.CUSTOM }) + } + } diff --git a/docs/development/themes.md b/docs/development/themes.md index 4bb122c6f3..8fbae55688 100644 --- a/docs/development/themes.md +++ b/docs/development/themes.md @@ -8,10 +8,7 @@ A theme is a `Palette` (`ui/Theme.kt`): a dark background scale (`background`, ` ## Gradient theme -`Themes.GRADIENT` is the one theme whose colours the person picks: a primary and a secondary, -kept in `SessionPrefs.gradientColors` and in `Themes.gradientColors`, a Compose state, so a change -restyles the whole app at once. `App.onCreate` loads the saved colours; code outside a composition -uses `Themes.current(context)`. +`Themes.GRADIENT` is the one of the theme whose colours the person picks: a primary and a secondary, kept in `SessionPrefs.gradientColors` and in `Themes.gradientColors`, a Compose state, so a change restyles the whole app at once. `App.onCreate` loads the saved colours; code outside a composition uses `Themes.current(context)`. `ThemeColors.palette` builds the full palette from the two colours: primary becomes `primary` / `signal`, secondary becomes `primary2`, the background scale is a dark neutral tinted with @@ -24,16 +21,24 @@ square. It opens `ColorPickerDialog`: a wheel (hue and saturation, touch), hue / brightness sliders (they work with a controller) and a hex box, with the old and new colour side by side. OK applies it. +## Custom theme + +`Themes.CUSTOM` stores a separate preference for every configurable palette colour: +background, surfaces, borders, text, accent, button text, signals, success and error. +`SessionPrefs.customThemeColors` restores the saved values, while `Themes.customColors` +is Compose state so changes update the interface immediately. + +The custom palette does not derive its surfaces from the accent. `primary2` intentionally +equals `primary`, keeping components that use the existing two-stop button and launch +effects visually solid. The colour picker reused from Gradient supports the wheel, sliders +and hexadecimal input. + ## Inner Gamer theme `Themes.INNER_GAMER` is an RGB theme: the accent walks round the colour wheel. It sits just above -Gradient in the list, and Setup shows a Speed slider (1 to 10, `SessionPrefs.rgbSpeed`) under the -theme while it is chosen. +Gradient in the list, and Setup shows a Speed slider (1 to 10, `SessionPrefs.rgbSpeed`) under the theme while it is chosen. -`Themes.innerGamer(hue)` builds the palette for one hue through `ThemeColors.palette`, so button text -keeps the same contrast along the gradient at every hue. `DroidDeckTheme` runs one -`rememberInfiniteTransition` while Inner Gamer is chosen, so the system's animation clock drives it. -Compose applies Android's animator scale to it, and the colour holds still when animations are off -in the app (`Motion.scale`) or in Android's own settings. The hue is written to `Themes.rgbHue` in 3° steps, which restyles the +`Themes.innerGamer(hue)` builds the palette for one hue through `ThemeColors.palette`, so button text keeps the same contrast along the gradient at every hue. `DroidDeckTheme` runs one `rememberInfiniteTransition` while Inner Gamer is chosen, so the system's animation clock drives it. +Compose applies Android's animator scale to it, and the colour holds still when animations are off in the app (`Motion.scale`) or in Android's own settings. The hue is written to `Themes.rgbHue` in 3° steps, which restyles the app only when the colour visibly moves; a slow cycle costs few recompositions.