package com.unogame.ui.theme import android.content.Context import androidx.compose.ui.graphics.Color enum class TableBg(val displayName: String, val color: Color, val isDark: Boolean = true) { DARK("暗黑", Color(0xFF121212), true), GREEN("墨绿", Color(0xFF1A3C2A), true), BLUE("深蓝", Color(0xFF0D1B2A), true), WARM("暖米", Color(0xFFF5F0E8), false), SKY("晴空", Color(0xFFE3F0F5), false), MINT("薄荷", Color(0xFFE8F5EC), false), ROSE("浅玫", Color(0xFFF5ECF0), false); companion object { private const val KEY = "table_bg" fun load(context: Context): TableBg { val name = context.getSharedPreferences("unogame_prefs", Context.MODE_PRIVATE) .getString(KEY, GREEN.name) ?: GREEN.name return try { valueOf(name) } catch (_: Exception) { GREEN } } fun save(context: Context, bg: TableBg) { context.getSharedPreferences("unogame_prefs", Context.MODE_PRIVATE) .edit().putString(KEY, bg.name).apply() } } }