    001    /* ===========================================================
    002     * JFreeChart : a free chart library for the Java(tm) platform
    003     * ===========================================================
    004     *
    005     * (C) Copyright 2000-2008, 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-2008, by Cameron Riley and Contributors.
    031     *
    032     * Original Author:  Cameron Riley;
    033     * Contributor(s):   David Gilbert (for Object Refinery Limited);
    034     *
    035     * Changes
    036     * -------
    037     * 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG);
    038     * 25-Nov-2004 : Changed first 7 colors to softer shades (DG);
    039     * 03-Nov-2005 : Removed orange color, too close to yellow - see bug
    040     *               report 1328408 (DG);
    041     * ------------- JFREECHART 1.0.x ---------------------------------------------
    042     * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
    043     *
    044     */
    045
    046    package org.jfree.chart;
    047
    048    import java.awt.Color;
    049    import java.awt.Paint;
    050
    051    /**
    052     * Class to extend the number of Colors available to the charts. This
    053     * extends the java.awt.Color object and extends the number of final
    054     * Colors publically accessible.
    055     */
    056    public class ChartColor extends Color {
    057
    058        /** A very dark red color. */
    059        public static final Color VERY_DARK_RED = new Color(0x80, 0x00, 0x00);
    060
    061        /** A dark red color. */
    062        public static final Color DARK_RED = new Color(0xc0, 0x00, 0x00);
    063
    064        /** A light red color. */
    065        public static final Color LIGHT_RED = new Color(0xFF, 0x40, 0x40);
    066
    067        /** A very light red color. */
    068        public static final Color VERY_LIGHT_RED = new Color(0xFF, 0x80, 0x80);
    069
    070        /** A very dark yellow color. */
    071        public static final Color VERY_DARK_YELLOW = new Color(0x80, 0x80, 0x00);
    072
    073        /** A dark yellow color. */
    074        public static final Color DARK_YELLOW = new Color(0xC0, 0xC0, 0x00);
    075
    076        /** A light yellow color. */
    077        public static final Color LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x40);
    078
    079        /** A very light yellow color. */
    080        public static final Color VERY_LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x80);
    081
    082        /** A very dark green color. */
    083        public static final Color VERY_DARK_GREEN = new Color(0x00, 0x80, 0x00);
    084
    085        /** A dark green color. */
    086        public static final Color DARK_GREEN = new Color(0x00, 0xC0, 0x00);
    087
    088        /** A light green color. */
    089        public static final Color LIGHT_GREEN = new Color(0x40, 0xFF, 0x40);
    090
    091        /** A very light green color. */
    092        public static final Color VERY_LIGHT_GREEN = new Color(0x80, 0xFF, 0x80);
    093
    094        /** A very dark cyan color. */
    095        public static final Color VERY_DARK_CYAN = new Color(0x00, 0x80, 0x80);
    096
    097        /** A dark cyan color. */
    098        public static final Color DARK_CYAN = new Color(0x00, 0xC0, 0xC0);
    099
    100        /** A light cyan color. */
    101        public static final Color LIGHT_CYAN = new Color(0x40, 0xFF, 0xFF);
    102
    103        /** Aa very light cyan color. */
    104        public static final Color VERY_LIGHT_CYAN = new Color(0x80, 0xFF, 0xFF);
    105
    106        /** A very dark blue color. */
    107        public static final Color VERY_DARK_BLUE = new Color(0x00, 0x00, 0x80);
    108
    109        /** A dark blue color. */
    110        public static final Color DARK_BLUE = new Color(0x00, 0x00, 0xC0);
    111
    112        /** A light blue color. */
    113        public static final Color LIGHT_BLUE = new Color(0x40, 0x40, 0xFF);
    114
    115        /** A very light blue color. */
    116        public static final Color VERY_LIGHT_BLUE = new Color(0x80, 0x80, 0xFF);
    117
    118        /** A very dark magenta/purple color. */
    119        public static final Color VERY_DARK_MAGENTA = new Color(0x80, 0x00, 0x80);
    120
    121        /** A dark magenta color. */
    122        public static final Color DARK_MAGENTA = new Color(0xC0, 0x00, 0xC0);
    123
    124        /** A light magenta color. */
    125        public static final Color LIGHT_MAGENTA = new Color(0xFF, 0x40, 0xFF);
    126
    127        /** A very light magenta color. */
    128        public static final Color VERY_LIGHT_MAGENTA = new Color(0xFF, 0x80, 0xFF);
    129
    130        /**
    131         * Creates a Color with an opaque sRGB with red, green and blue values in
    132         * range 0-255.
    133         *
    134         * @param r  the red component in range 0x00-0xFF.
    135         * @param g  the green component in range 0x00-0xFF.
    136         * @param b  the blue component in range 0x00-0xFF.
    137         */
    138        public ChartColor(int r, int g, int b) {
    139            super(r, g, b);
    140        }
    141
    142        /**
    143         * Convenience method to return an array of <code>Paint</code> objects that
    144         * represent the pre-defined colors in the <code>Color<code> and
    145         * <code>ChartColor</code> objects.
    146         *
    147         * @return An array of objects with the <code>Paint</code> interface.
    148         */
    149        public static Paint[] createDefaultPaintArray() {
    150
    151            return new Paint[] {
    152                new Color(0xFF, 0x55, 0x55),
    153                new Color(0x55, 0x55, 0xFF),
    154                new Color(0x55, 0xFF, 0x55),
    155                new Color(0xFF, 0xFF, 0x55),
    156                new Color(0xFF, 0x55, 0xFF),
    157                new Color(0x55, 0xFF, 0xFF),
    158                Color.pink,
    159                Color.gray,
    160                ChartColor.DARK_RED,
    161                ChartColor.DARK_BLUE,
    162                ChartColor.DARK_GREEN,
    163                ChartColor.DARK_YELLOW,
    164                ChartColor.DARK_MAGENTA,
    165                ChartColor.DARK_CYAN,
    166                Color.darkGray,
    167                ChartColor.LIGHT_RED,
    168                ChartColor.LIGHT_BLUE,
    169                ChartColor.LIGHT_GREEN,
    170                ChartColor.LIGHT_YELLOW,
    171                ChartColor.LIGHT_MAGENTA,
    172                ChartColor.LIGHT_CYAN,
    173                Color.lightGray,
    174                ChartColor.VERY_DARK_RED,
    175                ChartColor.VERY_DARK_BLUE,
    176                ChartColor.VERY_DARK_GREEN,
    177                ChartColor.VERY_DARK_YELLOW,
    178                ChartColor.VERY_DARK_MAGENTA,
    179                ChartColor.VERY_DARK_CYAN,
    180                ChartColor.VERY_LIGHT_RED,
    181                ChartColor.VERY_LIGHT_BLUE,
    182                ChartColor.VERY_LIGHT_GREEN,
    183                ChartColor.VERY_LIGHT_YELLOW,
    184                ChartColor.VERY_LIGHT_MAGENTA,
    185                ChartColor.VERY_LIGHT_CYAN
    186            };
    187        }
    188
    189    }