create RainbowSpan effect

public class RainbowSpan extends CharacterStyle implements UpdateAppearance {
    private final int[] colors;

    public RainbowSpan(Context context) {
        colors = new int[]{
                Color.parseColor("#FF0033"),
                Color.parseColor("#FF8000"),
                Color.parseColor("#FFE600"),
                Color.parseColor("#1AB34D"),
                Color.parseColor("#1A66FF"),
                Color.parseColor("#801AB3")
        };
    }

    @Override
    public void updateDrawState(TextPaint paint) {
        paint.setStyle(Paint.Style.FILL);
        Shader shader = new LinearGradient(
                0, 0, 0,
                paint.getTextSize() * colors.length,
                colors, null,
                Shader.TileMode.MIRROR);
        Matrix matrix = new Matrix();
        matrix.setRotate(90);
        shader.setLocalMatrix(matrix);
        paint.setShader(shader);
    }
}