mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
chore(DrawableColorPatch): Use hex value instead of raw value
This commit is contained in:
@ -12,10 +12,10 @@ import app.revanced.extension.shared.utils.ResourceUtils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class DrawableColorPatch {
|
||||
private static final int[] DARK_VALUES = {
|
||||
-14606047, // comments box background
|
||||
-16579837, // button container background in album
|
||||
-16777216, // button container background in playlist
|
||||
private static final int[] DARK_COLORS = {
|
||||
0xFF212121, // comments box background
|
||||
0xFF030303, // button container background in album
|
||||
0xFF000000, // button container background in playlist
|
||||
};
|
||||
|
||||
// background colors
|
||||
@ -26,10 +26,10 @@ public class DrawableColorPatch {
|
||||
private static final int elementsContainerIdentifier =
|
||||
ResourceUtils.getIdIdentifier("elements_container");
|
||||
|
||||
public static int getLithoColor(int originalValue) {
|
||||
return ArrayUtils.contains(DARK_VALUES, originalValue)
|
||||
public static int getLithoColor(int colorValue) {
|
||||
return ArrayUtils.contains(DARK_COLORS, colorValue)
|
||||
? blackColor
|
||||
: originalValue;
|
||||
: colorValue;
|
||||
}
|
||||
|
||||
public static void setHeaderGradient(ViewGroup viewGroup) {
|
||||
|
@ -1,34 +1,36 @@
|
||||
package app.revanced.extension.youtube.patches.utils;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import app.revanced.extension.shared.utils.ResourceUtils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class DrawableColorPatch {
|
||||
private static final int[] WHITE_VALUES = {
|
||||
-1, // comments chip background
|
||||
-394759, // music related results panel background
|
||||
-83886081 // video chapters list background
|
||||
private static final int[] DARK_COLORS = {
|
||||
0xFF282828, // drawer content view background
|
||||
0xFF212121, // comments chip background
|
||||
0xFF181818, // music related results panel background
|
||||
0xFF0F0F0F, // comments chip background (new layout)
|
||||
0xFA212121, // video chapters list background
|
||||
};
|
||||
|
||||
private static final int[] DARK_VALUES = {
|
||||
-14145496, // drawer content view background
|
||||
-14606047, // comments chip background
|
||||
-15198184, // music related results panel background
|
||||
-15790321, // comments chip background (new layout)
|
||||
-98492127 // video chapters list background
|
||||
private static final int[] LIGHT_COLORS = {
|
||||
0xFFFF, // comments chip background
|
||||
0xFFF9F9F9, // music related results panel background
|
||||
0xFAFFFFFF, // video chapters list background
|
||||
};
|
||||
|
||||
// background colors
|
||||
private static int whiteColor = 0;
|
||||
private static int blackColor = 0;
|
||||
|
||||
public static int getLithoColor(int originalValue) {
|
||||
if (anyEquals(originalValue, DARK_VALUES)) {
|
||||
public static int getLithoColor(int colorValue) {
|
||||
if (ArrayUtils.contains(DARK_COLORS, colorValue)) {
|
||||
return getBlackColor();
|
||||
} else if (anyEquals(originalValue, WHITE_VALUES)) {
|
||||
} else if (ArrayUtils.contains(LIGHT_COLORS, colorValue)) {
|
||||
return getWhiteColor();
|
||||
}
|
||||
return originalValue;
|
||||
return colorValue;
|
||||
}
|
||||
|
||||
private static int getBlackColor() {
|
||||
@ -40,11 +42,6 @@ public class DrawableColorPatch {
|
||||
if (whiteColor == 0) whiteColor = ResourceUtils.getColor("yt_white1");
|
||||
return whiteColor;
|
||||
}
|
||||
|
||||
private static boolean anyEquals(int value, int... of) {
|
||||
for (int v : of) if (value == v) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user