Theming: chart use default design background color.

This commit is contained in:
Dennis Guse
2020-09-15 20:09:36 +02:00
parent 240cb4b363
commit caec5e7c45
2 changed files with 29 additions and 2 deletions
@@ -0,0 +1,24 @@
package de.dennisguse.opentracks.util;
import android.content.Context;
import android.content.res.Resources;
import android.util.TypedValue;
import androidx.core.content.ContextCompat;
public class ThemeUtils {
private ThemeUtils() {
}
/**
* Get the material design default background color.
*/
public static int getBackgroundColor(Context context) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = context.getTheme();
theme.resolveAttribute(android.R.attr.colorBackground, typedValue, true);
return ContextCompat.getColor(context, typedValue.resourceId);
}
}