package com.strohwitwer.awesomevalidation.helper;

import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.widget.EditText;

import java.util.ArrayList;

public class SpanHelper {

    private SpanHelper() {}

    public static void setColor(EditText editText, int color, ArrayList<int[]> ranges) {
        String text = editText.getText().toString();
        SpannableString spanText = new SpannableString(text);
        for (int[] range : ranges) {
            BackgroundColorSpan markup = new BackgroundColorSpan(color);
            spanText.setSpan(markup, range[0], range[1] + 1, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        }
        editText.setText(spanText);
    }

}
@@ -159,16 +159,58 @@
 orSpan;%0A
+import android.text.style.CharacterStyle;%0A
 import a
@@ -784,9 +784,319 @@
 %0A    %7D%0A%0A
+    public static void reset(EditText editText) %7B%0A        Object%5B%5D spans = editText.getText().getSpans(0, editText.length(), Object.class);%0A        for (Object span : spans) %7B%0A            if (span instanceof CharacterStyle) %7B%0A                editText.getText().removeSpan(span);%0A            %7D%0A        %7D%0A    %7D%0A%0A
 %7D

Add remove all spans method to SpanHelper.