I have a static utils class method to get colors from the current theme. Most often it is colorPrimary, colorPrimaryDark and accentColor, but you can get a lot more.
@ColorInt public static int getThemeColor ( @NonNull final Context context, @AttrRes final int attributeColor ) { final TypedValue value = new TypedValue(); context.getTheme ().resolveAttribute (attributeColor, value, true); return value.data; }
Sotti Feb 06 '16 at 22:16 2016-02-06 22:16
source share