muted accent

This commit is contained in:
gdlbo
2022-12-05 15:20:28 +03:00
parent fd070323b0
commit 17b9c7075e
2 changed files with 24 additions and 2 deletions
@@ -13,11 +13,21 @@ public class ColorReferences {
Color.parseColor("#4986cc"), // azure_a400
Color.parseColor("#528bcc"), // another light accent
Color.parseColor("#71aaeb"), // vk_sky_300 (dark accent)
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.button_muted_foreground_disabled),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.button_muted_foreground),
Color.parseColor("#5181b8") // header_blue
);
public static List<Integer> mutedAccentColors = Arrays.asList(
Color.parseColor("#663f8ae0"),
Color.parseColor("#19528bcc"),
Color.parseColor("#66528bcc"),
Color.parseColor("#1971aaeb"),
Color.parseColor("#665181b8"),
Color.parseColor("#1a003973"),
Color.parseColor("#a800244d"),
Color.parseColor("#14001c3d"),
Color.parseColor("#3d001c3d")
);
public static boolean isAccentedColor(ColorStateList target) {
return target != null && isAccentedColor(target.getDefaultColor());
}
@@ -26,6 +36,14 @@ public class ColorReferences {
return accentColors.contains(target);
}
public static boolean isMutedAccentedColor(ColorStateList target) {
return target != null && isMutedAccentedColor(target.getDefaultColor());
}
public static boolean isMutedAccentedColor(int target) {
return mutedAccentColors.contains(target);
}
public static boolean isColorRefAccented(int target) {
return ThemesUtils.isColorRefAccented(target);
}
@@ -95,6 +95,10 @@ public class ThemesUtils {
return accent == 0 ? getColorFromAttr(R.attr.accent) : accent;
} // Color accent
public static int getMutedAccentColor() {
return ThemesUtils.halfAlpha(ThemesUtils.getAccentColor());
}
public static void setCustomAccentColor(int newColor, boolean async) {
var editor = AndroidUtils.edit().putInt("accent_color", newColor);
if (async) editor.apply();