The approach I have used is that, keep your colors in an array and let users select the color and store the index of selected color in preferences. So once when the activity is loading read the stored color and set the color accordingly
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(this,colors.getResourceId(chapter_key-1, 0)));
}

package com.**********.app.customViews;
/**
* Created by pakistantechhouse on 18/02/2017.
*/
import android.content.Context;
import android.graphics.Canvas;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.**********.app.R;
public class CRelativeLayout extends RelativeLayout {
public CRelativeLayout(Context context) {
super(context);
if (!isInEditMode()) {
//TODO get your color here from the preferences and apply to the view
this.setBackgroundColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
}
public CRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode()) {
//TODO get your color here from the preferences and apply to the view
this.setBackgroundColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
}
public CRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (!isInEditMode()) {
//TODO get your color here from the preferences and apply to the view
this.setBackgroundColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
}
protected void onDraw (Canvas canvas) {
super.onDraw(canvas);
}
}