Make old opaque theme colors translucent once
Configs saved before 0.1.3 hold the old default and preset background and primary colors fully opaque, so glass didn't show for anyone updating. On a config without Menu blur (new in 0.1.3), colors that are an old default or preset get their translucent alpha; colors players picked stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -81,6 +81,29 @@ public class Theme {
|
||||
config.property("Widget Radius", WIDGET_RADIUS, "Corner rounding of buttons and cards");
|
||||
|
||||
config.property("Font", FONT, "Font of every Saturn screen");
|
||||
|
||||
if (!parent.isSaved(Config.MENU_BLUR)) {
|
||||
upgradeOpaqueColors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Before 0.1.3 panels and cards were made translucent in code, and the
|
||||
* background and primary colors were saved fully opaque. Saved colors that
|
||||
* are an old default or preset get the translucency the colors now carry
|
||||
* themselves; colors the player picked are left as they are. Runs only on
|
||||
* configs from older versions, so a preset color later set opaque on
|
||||
* purpose stays opaque.
|
||||
*/
|
||||
private static void upgradeOpaqueColors() {
|
||||
for (Preset preset : PRESETS) {
|
||||
if (BACKGROUND.value == (preset.background() | 0xFF000000)) {
|
||||
BACKGROUND.value = preset.background();
|
||||
}
|
||||
if (PRIMARY.value == (preset.primary() | 0xFF000000)) {
|
||||
PRIMARY.value = preset.primary();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user