Skip to content

Commit

Permalink
fix(youtube/theme): theme litho UI components (#176)
Browse files Browse the repository at this point in the history
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
  • Loading branch information
OxrxL and oSumAtrIX committed Oct 25, 2022
1 parent 8127f8b commit f06935d
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package app.revanced.integrations.patches;

import android.util.Log;

import app.revanced.integrations.utils.ThemeHelper;

public class LithoThemePatch {
// color constants used in relation with litho components
private static final int[] WHITECONSTANTS = {
-1, // comments chip background
-394759, // music related results panel background
-83886081, // video chapters list background
};

private static final int[] DARKCONSTANTS = {
-14606047, // comments chip background
-15198184, // music related results panel background
-15790321, // comments chip background (new layout)
-98492127 // video chapters list background
};

// Used by app.revanced.patches.youtube.layout.theme.patch.LithoThemePatch
public static int applyLithoTheme(int originalValue) {
var isDarkTheme = ThemeHelper.isDarkTheme();

if ((isDarkTheme && anyEquals(originalValue, DARKCONSTANTS)) || (!isDarkTheme && anyEquals(originalValue, WHITECONSTANTS)))
return 0;
return originalValue;
}

private static boolean anyEquals(int value, int... of) {
for (int v : of) if (value == v) return true;
return false;
}
}

0 comments on commit f06935d

Please sign in to comment.