    001    /* ===========================================================
    002     * JFreeChart : a free chart library for the Java(tm) platform
    003     * ===========================================================
    004     *
    005     * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
    006     *
    007     * Project Info:  http://www.jfree.org/jfreechart/index.html
    008     *
    009     * This library is free software; you can redistribute it and/or modify it
    010     * under the terms of the GNU Lesser General Public License as published by
    011     * the Free Software Foundation; either version 2.1 of the License, or
    012     * (at your option) any later version.
    013     *
    014     * This library is distributed in the hope that it will be useful, but
    015     * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    016     * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
    017     * License for more details.
    018     *
    019     * You should have received a copy of the GNU Lesser General Public
    020     * License along with this library; if not, write to the Free Software
    021     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
    022     * USA.
    023     *
    024     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
    025     * in the United States and other countries.]
    026     *
    027     * ---------------
    028     * ChartColor.java
    029     * ---------------
    030     * (C) Copyright 2003-2007, by Cameron Riley and Contributors.
    031     *
    032     * Original Author:  Cameron Riley;
    033     * Contributor(s):   David Gilbert (for Object Refinery Limited);
    034     *
    035     * $Id: ChartColor.java,v 1.3.2.3 2007/02/02 15:53:36 mungady Exp $
    036     *
    037     * Changes
    038     * -------
    039     * 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG);
    040     * 25-Nov-2004 : Changed first 7 colors to softer shades (DG);
    041     * 03-Nov-2005 : Removed orange color, too close to yellow - see bug
    042     *               report 1328408 (DG);
    043     * ------------- JFREECHART 1.0.x ---------------------------------------------
    044     * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
    045     *
    046     */
    047
    048    package org.jfree.chart;
    049
    050    import java.awt.Color;
    051    import java.awt.Paint;
    052
    053    /**
    054     * Class to extend the number of Colors available to the charts. This
    055     * extends the java.awt.Color object and extends the number of final
    056     * Colors publically accessible.
    057     */
    058    public class ChartColor extends Color {
    059
    060        /** A very dark red color. */
    061        public static final Color VERY_DARK_RED = new Color(0x80, 0x00, 0x00);
    062
    063        /** A dark red color. */
    064        public static final Color DARK_RED = new Color(0xc0, 0x00, 0x00);
    065
    066        /** A light red color. */
    067        public static final Color LIGHT_RED = new Color(0xFF, 0x40, 0x40);
    068
    069        /** A very light red color. */
    070        public static final Color VERY_LIGHT_RED = new Color(0xFF, 0x80, 0x80);
    071
    072        /** A very dark yellow color. */
    073        public static final Color VERY_DARK_YELLOW = new Color(0x80, 0x80, 0x00);
    074
    075        /** A dark yellow color. */
    076        public static final Color DARK_YELLOW = new Color(0xC0, 0xC0, 0x00);
    077
    078        /** A light yellow color. */
    079        public static final Color LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x40);
    080
    081        /** A very light yellow color. */
    082        public static final Color VERY_LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x80);
    083
    084        /** A very dark green color. */
    085        public static final Color VERY_DARK_GREEN = new Color(0x00, 0x80, 0x00);
    086
    087        /** A dark green color. */
    088        public static final Color DARK_GREEN = new Color(0x00, 0xC0, 0x00);
    089
    090        /** A light green color. */
    091        public static final Color LIGHT_GREEN = new Color(0x40, 0xFF, 0x40);
    092
    093        /** A very light green color. */
    094        public static final Color VERY_LIGHT_GREEN = new Color(0x80, 0xFF, 0x80);
    095
    096        /** A very dark cyan color. */
    097        public static final Color VERY_DARK_CYAN = new Color(0x00, 0x80, 0x80);
    098
    099        /** A dark cyan color. */
    100        public static final Color DARK_CYAN = new Color(0x00, 0xC0, 0xC0);
    101
    102        /** A light cyan color. */
    103        public static final Color LIGHT_CYAN = new Color(0x40, 0xFF, 0xFF);
    104
    105        /** Aa very light cyan color. */
    106        public static final Color VERY_LIGHT_CYAN = new Color(0x80, 0xFF, 0xFF);
    107
    108        /** A very dark blue color. */
    109        public static final Color VERY_DARK_BLUE = new Color(0x00, 0x00, 0x80);
    110
    111        /** A dark blue color. */
    112        public static final Color DARK_BLUE = new Color(0x00, 0x00, 0xC0);
    113
    114        /** A light blue color. */
    115        public static final Color LIGHT_BLUE = new Color(0x40, 0x40, 0xFF);
    116
    117        /** A very light blue color. */
    118        public static final Color VERY_LIGHT_BLUE = new Color(0x80, 0x80, 0xFF);
    119
    120        /** A very dark magenta/purple color. */
    121        public static final Color VERY_DARK_MAGENTA = new Color(0x80, 0x00, 0x80);
    122
    123        /** A dark magenta color. */
    124        public static final Color DARK_MAGENTA = new Color(0xC0, 0x00, 0xC0);
    125
    126        /** A light magenta color. */
    127        public static final Color LIGHT_MAGENTA = new Color(0xFF, 0x40, 0xFF);
    128
    129        /** A very light magenta color. */
    130        public static final Color VERY_LIGHT_MAGENTA = new Color(0xFF, 0x80, 0xFF);
    131
    132        /**
    133         * Creates a Color with an opaque sRGB with red, green and blue values in
    134         * range 0-255.
    135         *
    136         * @param r  the red component in range 0x00-0xFF.
    137         * @param g  the green component in range 0x00-0xFF.
    138         * @param b  the blue component in range 0x00-0xFF.
    139         */
    140        public ChartColor(int r, int g, int b) {
    141            super(r, g, b);
    142        }
    143
    144        /**
    145         * Convenience method to return an array of <code>Paint</code> objects that
    146         * represent the pre-defined colors in the <code>Color<code> and
    147         * <code>ChartColor</code> objects.
    148         *
    149         * @return An array of objects with the <code>Paint</code> interface.
    150         */
    151        public static Paint[] createDefaultPaintArray() {
    152
    153            return new Paint[] {
    154                new Color(0xFF, 0x55, 0x55),
    155                new Color(0x55, 0x55, 0xFF),
    156                new Color(0x55, 0xFF, 0x55),
    157                new Color(0xFF, 0xFF, 0x55),
    158                new Color(0xFF, 0x55, 0xFF),
    159                new Color(0x55, 0xFF, 0xFF),
    160                Color.pink,
    161                Color.gray,
    162                ChartColor.DARK_RED,
    163                ChartColor.DARK_BLUE,
    164                ChartColor.DARK_GREEN,
    165                ChartColor.DARK_YELLOW,
    166                ChartColor.DARK_MAGENTA,
    167                ChartColor.DARK_CYAN,
    168                Color.darkGray,
    169                ChartColor.LIGHT_RED,
    170                ChartColor.LIGHT_BLUE,
    171                ChartColor.LIGHT_GREEN,
    172                ChartColor.LIGHT_YELLOW,
    173                ChartColor.LIGHT_MAGENTA,
    174                ChartColor.LIGHT_CYAN,
    175                Color.lightGray,
    176                ChartColor.VERY_DARK_RED,
    177                ChartColor.VERY_DARK_BLUE,
    178                ChartColor.VERY_DARK_GREEN,
    179                ChartColor.VERY_DARK_YELLOW,
    180                ChartColor.VERY_DARK_MAGENTA,
    181                ChartColor.VERY_DARK_CYAN,
    182                ChartColor.VERY_LIGHT_RED,
    183                ChartColor.VERY_LIGHT_BLUE,
    184                ChartColor.VERY_LIGHT_GREEN,
    185                ChartColor.VERY_LIGHT_YELLOW,
    186                ChartColor.VERY_LIGHT_MAGENTA,
    187                ChartColor.VERY_LIGHT_CYAN
    188            };
    189        }
    190
    191    }