@RequiresApi(api = Build.VERSION_CODES.M)
    @ColorInt
    public static int getDefaultColor(Context context, int resId) {
        final ColorStateList list =
                context.getResources().getColorStateList(resId, context.getTheme());

        return list.getDefaultColor();
    }
This method converts device specific pixels to density independent pixels.

@param px      A value in px (pixels) unit. Which we need to convert into db
@param context Context to get resources and device specific display metrics
@return A float value to represent dp equivalent to px value
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/ResUtils.java