feat(ui): add vertical brightness fills, dark mode, and websocket toggle
All checks were successful
Update Wiki Documentation / generate-docs (push) Successful in 2m26s

This commit is contained in:
Krzysztof Cieślik
2026-06-14 17:51:46 +02:00
parent ff8b94feea
commit 948ad4a425
23 changed files with 678 additions and 238 deletions

View File

@@ -49,6 +49,10 @@ enum class StringKey {
LABEL_TOKEN,
/** Input label for refresh interval. */
LABEL_REFRESH,
/** Label for WebSocket toggle. */
LABEL_WEBSOCKET_ENABLE,
/** Label for Dark Mode toggle. */
LABEL_DARK_MODE,
/** Button text for testing and saving connection. */
BTN_TEST_SAVE,
/** Button text for deleting all widgets. */

View File

@@ -1,65 +1,46 @@
package com.example.retroha.theme
import android.content.Context
import com.example.retroha.data.Prefs
/**
* Bauhaus-inspired color palette for the application.
* All colors are defined as ARGB integers.
* Supports both Light and Dark themes.
*/
object Colors {
/** Pure black for borders, shadows, and text. */
// Fixed Bauhaus Colors
const val BLACK = 0xFF000000.toInt()
/** Pure white for backgrounds and default states. */
const val WHITE = 0xFFFFFFFF.toInt()
/** Bauhaus red. Used for scripts and high-priority states. */
const val RED = 0xFFE23A24.toInt()
/** Bauhaus yellow. Used for active (ON) highlights. */
const val YELLOW = 0xFFFAD02C.toInt()
/** Bauhaus blue. Used for switches and interactive elements. */
const val BLUE = 0xFF0056B3.toInt()
/** Bauhaus orange. Used for light-domain entities. */
const val ORANGE = 0xFFF4801A.toInt()
/** Bauhaus green. Secondary status color. */
const val GREEN = 0xFF2D7D46.toInt()
/** Bauhaus violet. Used for sensors and measurements. */
const val VIOLET = 0xFF6B3FA0.toInt()
/** Light gray for background elements. */
const val GRAY_LIGHT = 0xFFCCCCCC.toInt()
/** Mid gray for disabled borders. */
const val GRAY_MID = 0xFF888888.toInt()
/** Dark gray for default category stripes. */
const val GRAY_DARK = 0xFF444444.toInt()
const val DARK_BG = 0xFF1A1A1A.toInt()
const val DARK_CARD = 0xFF2D2D2D.toInt()
// Semantic status colors
/** Card background color when entity is ON. */
// Dynamic semantic colors
fun getBgColor(context: Context): Int = if (Prefs.isDarkMode(context)) DARK_BG else WHITE
fun getTextColor(context: Context): Int = if (Prefs.isDarkMode(context)) WHITE else BLACK
fun getBorderColor(context: Context): Int = if (Prefs.isDarkMode(context)) GRAY_DARK else BLACK
fun getShadowColor(context: Context): Int = if (Prefs.isDarkMode(context)) BLACK else BLACK
// Status colors
const val STATUS_ON = YELLOW
/** Card background color when entity is OFF. */
const val STATUS_OFF = WHITE
/** Card background color when entity is unavailable. */
fun getStatusOff(context: Context): Int = if (Prefs.isDarkMode(context)) DARK_CARD else WHITE
const val STATUS_UNAVAILABLE = GRAY_LIGHT
/** Card background color during state transition. */
const val STATUS_TOGGLING = WHITE
fun getStatusToggling(context: Context): Int = getStatusOff(context)
// Semantic border colors
/** Default card border color. */
const val BORDER_DEFAULT = BLACK
/** Border color during state transition. */
const val BORDER_TOGGLING = BLUE
/** Border color when entity is unavailable. */
const val BORDER_UNAVAILABLE = GRAY_MID
// Domain-specific side stripes
/** Accent stripe for light domain. */
// Domain stripes (remain mostly fixed for Bauhaus style)
const val STRIPE_LIGHT = ORANGE
/** Accent stripe for switch domain. */
const val STRIPE_SWITCH = BLUE
/** Accent stripe for sensor domain. */
const val STRIPE_SENSOR = VIOLET
/** Accent stripe for binary_sensor domain. */
const val STRIPE_BINARY_SENSOR = VIOLET
/** Accent stripe for script domain. */
const val STRIPE_SCRIPT = RED
/** Accent stripe for automation domain. */
const val STRIPE_AUTOMATION = RED
/** Default accent stripe for unknown domains. */
const val STRIPE_DEFAULT = GRAY_DARK
}