public static int getColor(Context context, @AttrRes int attrId) {
        int color = 0;
        TypedArray a = context.obtainStyledAttributes(new int[]{attrId});
        try {
            color = a.getColor(0, 0);
        } catch (UnsupportedOperationException e) {
            error("color", attrId, e);
        }
        a.recycle();
        return color;
    }
public static int getColor(Context context, @AttrRes int attrId) {
        int color = 0;
        TypedArray a = context.obtainStyledAttributes(new int[]{attrId});
        try {
            color = a.getColor(0, 0);
        } catch (UnsupportedOperationException e) {
            error("color", attrId, e);
        }
        a.recycle();
        return color;
    }
public static int getColor ( Context context , @ AttrRes int attrId ) { int color = 0 ; TypedArray a = context . obtainStyledAttributes ( new int [ ] { attrId } ) ; try { color = a . getColor ( 0 , 0 ) ; } catch ( UnsupportedOperationException e ) { error ( "color" , attrId , e ) ; } a . recycle ( ) ; return color ; }
Get the color specified by the attribute in the Context's theme.

@since 4.0.0
Get the color specified by the attribute in the Context s theme .