random Sub Color - Android java.util

Android examples for java.util:Random

Description

random Sub Color

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {
    public static int randomSubColor(int color) {
        float[] hsv = new float[3];
        Color.colorToHSV(color, hsv);
        hsv[0] = ((float) (Math.random() * 50 - 25) + hsv[0]) % 360;
        //        hsv[1] = (float) (Math.random() * 0.3 + 0.7);
        //        hsv[2] = 1;
        return Color.HSVToColor((int) (Math.random() * 50 + 200), hsv);
    }// w  w  w.ja va2s.co  m
}

Related Tutorials