001/*******************************************************************************
002 * This software is provided as a supplement to the authors' textbooks on digital
003 *  image processing published by Springer-Verlag in various languages and editions.
004 * Permission to use and distribute this software is granted under the BSD 2-Clause 
005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 
006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 
007 * Visit http://imagingbook.com for additional details.
008 *******************************************************************************/
009
010package imagingbook.pub.fd;
011
012import java.awt.Color;
013
014public class Colors {
015        
016        public static Color Red         = new Color(240, 0, 0);
017        public static Color Green       = new Color(0, 185, 15);
018        public static Color Blue        = new Color(0, 60, 255);
019        public static Color Magenta = new Color(255, 0, 200);
020        public static Color Yellow      = new Color(255, 155, 0);
021        public static Color Brown       = new Color(128, 66, 36);
022        
023        public static Color[] defaultDisplayColors = {
024                Red, Green, Blue, Magenta, Yellow, Brown
025                };
026        
027        public static class ColorSequencer {
028                
029                private int nextColorIndex = 0;
030                
031                public ColorSequencer() {
032                }
033                
034                public ColorSequencer(int firstIndex) {
035                        nextColorIndex = firstIndex % defaultDisplayColors.length;
036                }
037                
038                public Color nextColor() {
039                        Color c = defaultDisplayColors[nextColorIndex];
040                        nextColorIndex = (nextColorIndex + 1) % defaultDisplayColors.length;
041                        return c;
042                }
043                
044        }
045
046}