/*
 * Copyright (c) 1997, Subrahmanyam Allamaraju. All Rights Reserved.
 * 
 * Permission to use, copy, modify, and distribute this software for
 * NON-COMMERCIAL purposes and without fee is hereby granted provided that this
 * copyright notice appears in all copies.
 *
 * This software is intended for demonstration purposes only, and comes without
 * any explicit or implicit warranty.
 *
 * Please report any bugs to subrahmanyam@geocities.com
 *
 */

import java.awt.Color;

public class VColor 
{

    private static final double BRIGHTER_FACTOR = 0.25; 
    private static final double DARKER_FACTOR = 0.75; 

    public static Color brighterShade(Color color) 
	{
	    Color newcolor = new Color(
		Math.min((int)(color.getRed() * (1/BRIGHTER_FACTOR)), 255),
		Math.min((int)(color.getGreen() * (1/BRIGHTER_FACTOR)), 255),
		Math.min((int)(color.getBlue() *(1/BRIGHTER_FACTOR)), 255));  
	    if(newcolor.equals(color)) {
	        return Color.white;
	    }
	    return newcolor;
    }

    public static Color darkerShade(Color color) 
	{
	    Color newcolor = new Color(
		Math.max((int)(color.getRed() * DARKER_FACTOR), 0),
		Math.max((int)(color.getGreen() * DARKER_FACTOR), 0), 
		Math.max((int)(color.getBlue() * DARKER_FACTOR), 0));
	    if(newcolor.equals(color)) {
		return Color.black;
	    }
	    return newcolor;
	}
}
