MD3 Accent color for Switch
This commit is contained in:
parent
531623b9b2
commit
b2a1cb1e2e
6 changed files with 34 additions and 10 deletions
|
@ -22,14 +22,20 @@ import android.graphics.Color;
|
|||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.palette.graphics.Palette;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class RetroColorUtil {
|
||||
public static int desaturateColor(int color, float ratio) {
|
||||
|
@ -216,6 +222,14 @@ public class RetroColorUtil {
|
|||
return color;
|
||||
}
|
||||
|
||||
public static int getMD3AccentColor(@NotNull Context context) {
|
||||
if (VersionUtils.hasS()) {
|
||||
return ContextCompat.getColor(context, R.color.m3_accent_color);
|
||||
} else {
|
||||
return ThemeStore.Companion.accentColor(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SwatchComparator implements Comparator<Palette.Swatch> {
|
||||
|
||||
private static SwatchComparator sInstance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue