updateThemeFromBackground function
Updates theme based on background hex color (e.g., '#1a1a1a').
Automatically determines if the background is dark based on luminance.
Implementation
void updateThemeFromBackground(String? hex) {
if (hex == null || hex.isEmpty) return;
final h = hex.startsWith('#') ? hex.substring(1) : hex;
if (h.length != 6) return;
final r = int.tryParse(h.substring(0, 2), radix: 16);
final g = int.tryParse(h.substring(2, 4), radix: 16);
final b = int.tryParse(h.substring(4, 6), radix: 16);
if (r == null || g == null || b == null) return;
_hasDarkBackground = isDarkColorRgb(red: r, green: g, blue: b);
}