I am using ProgressDialog for showing progressbar 
            ProgressDialog progressDialog = new ProgressDialog(context);
            progress         
        This is not a perfect solution, but may help.
Also check my previous comment. https://stackoverflow.com/a/39687893/2598453
final ProgressDialog progress = new ProgressDialog(this);
progress.setMessage(getString(R.string.progress_message));
progress.setIndeterminate(true);
progress.setCancelable(false);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    Drawable drawable = new ProgressBar(this).getIndeterminateDrawable().mutate();
    drawable.setColorFilter(ContextCompat.getColor(this, R.color.colorAccent),
            PorterDuff.Mode.SRC_IN);
    progress.setIndeterminateDrawable(drawable);
}
progress.show();
If you already use material dialogs library (https://github.com/afollestad/material-dialogs#indeterminate-progress-dialogs) the simplest solution could be to use the progress dialog from that library. The circle will be automatically colored with the primary color:
MaterialDialog dialog = new MaterialDialog.Builder(context)
                    .content(R.string.loading)
                    .progress(true, 0)
                    .show();
Try this:
Example where setting color to red:
ProgressBar spinner = new android.widget.ProgressBar(
                context,
                null,
                android.R.attr.progressBarStyle);
spinner.getIndeterminateDrawable().setColorFilter(0xFFFF0000, android.graphics.PorterDuff.Mode.MULTIPLY);
Add Style.xml
<style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
    <item name="colorAccent">@color/colorPrimary</item>
</style>
set style to progress dialog
pdialog = new ProgressDialog(context, R.style.MyAlertDialogStyle);
If you'd like to define the colour ad-hoc, without needing inheritance or dedicated XML, you can use something like this:
/** Styles a ProgressDialog to use a themed Spinner. */
public void setStyledProgressDialog(final Context pContext, final ProgressDialog pProgressDialog, final int pColorResourceId) {
    // Allocate a new ProgressBar.
    final ProgressBar lProgressBar = new android.widget.ProgressBar(pContext, null, android.R.attr.progressBarStyle);
    // Configure the IndeterminateDrawable.
    lProgressBar.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(pContext, pColorResourceId), android.graphics.PorterDuff.Mode.MULTIPLY);
    // Assign the ProgressBar to the ProgressDialog.
    pProgressDialog.setIndeterminateDrawable(lProgressBar.getIndeterminateDrawable());
}
The perfect and simple solution for custom color progress bar.
public class CustomProgressBar extends ProgressBar{
    public CustomProgressBar(Context context) {
        super(context);
        this.setIndeterminate(true);
        this.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.app_blue), PorterDuff.Mode.MULTIPLY);
    }
    public CustomProgressBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.app_blue), PorterDuff.Mode.MULTIPLY);
    }
    public CustomProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
}
and use it in your layout.
<RelativeLayout
        android:id="@+id/loadingPanel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:visibility="gone">
        <com.mayproject.views.CustomProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </RelativeLayout>