Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Use of this source code is governed by a BSD-style license that can be

import android.graphics.Color;

public class Main {
    /** Percentage to darken the brand color by when setting the status bar color. */
    private static final float DARKEN_COLOR_FRACTION = 0.6f;

    /**
     * Darkens the given color to use on the status bar.
     * @param color Brand color of the website.
     * @return Color that should be used for Android status bar.
     */
    public static int computeStatusBarColor(int color) {
        float[] hsv = new float[3];
        Color.colorToHSV(color, hsv);
        hsv[2] *= DARKEN_COLOR_FRACTION;
        return Color.HSVToColor(hsv);
    }
}