get Highlight Color from sample Color - Android Graphics

Android examples for Graphics:Color

Description

get Highlight Color from sample Color

Demo Code


//package com.java2s;

import android.graphics.Color;

public class Main {
    public static int getHighlightColor(int sampleColor) {
        // Set a constant value level in HSV, in case the averaged color is too light or too dark.
        float[] hsvBackground = new float[3];
        Color.colorToHSV(sampleColor, hsvBackground);
        hsvBackground[2] = 0.3f; // value parameter

        return Color.HSVToColor(0xf2, hsvBackground);
    }/*w ww  .j a  va2s  .co m*/
}

Related Tutorials