From 6300313889eced258e0657260d2da88dedcabf63 Mon Sep 17 00:00:00 2001 From: Ido Ben-Hur Date: Mon, 21 Oct 2024 11:50:32 +0300 Subject: [PATCH] Evolver: Allow chroma & luminance to affect secondary colors [2/2] Signed-off-by: Pranav Vashi Signed-off-by: AnierinB --- res/values/evolution_strings.xml | 2 ++ res/xml/monet_engine.xml | 6 ++++++ .../fragments/themes/MonetSettings.java | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/res/values/evolution_strings.xml b/res/values/evolution_strings.xml index 8090d81..578328c 100644 --- a/res/values/evolution_strings.xml +++ b/res/values/evolution_strings.xml @@ -60,6 +60,8 @@ Higher values produce brighter colors Chroma factor Higher values produce stronger colors + Whole palette + Make Luminance and Chroma selection affect secondary colors as well Tint background Make luminance and chroma selection affect background colors as well Theme style diff --git a/res/xml/monet_engine.xml b/res/xml/monet_engine.xml index 69ae522..f86860d 100644 --- a/res/xml/monet_engine.xml +++ b/res/xml/monet_engine.xml @@ -74,6 +74,12 @@ settings:units="%" settings:showSign="true" /> + + 1d) chromaV = Math.round((chroma - 1f) * 100f); else if (chroma < 1d) chromaV = -1 * Math.round((1f - chroma) * 100f); mChromaPref.setValue(chromaV); + mWholePalettePref.setChecked(wholePalette); mTintBackgroundPref.setChecked(tintBG); } catch (JSONException | IllegalArgumentException ignored) {} } @@ -248,6 +256,10 @@ public class MonetSettings extends DashboardFragment implements int value = (Integer) newValue; setChromaValue(value); return true; + } else if (preference == mWholePalettePref) { + boolean value = (Boolean) newValue; + setWholePaletteValue(value); + return true; } else if (preference == mTintBackgroundPref) { boolean value = (Boolean) newValue; setTintBackgroundValue(value); @@ -369,6 +381,15 @@ public class MonetSettings extends DashboardFragment implements } catch (JSONException | IllegalArgumentException ignored) {} } + private void setWholePaletteValue(boolean whole) { + try { + JSONObject object = getSettingsJson(); + if (!whole) object.remove(OVERLAY_WHOLE_PALETTE); + else object.putOpt(OVERLAY_WHOLE_PALETTE, 1); + putSettingsJson(object); + } catch (JSONException | IllegalArgumentException ignored) {} + } + private void setTintBackgroundValue(boolean tint) { try { JSONObject object = getSettingsJson();