001: /*
002: * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of Substance Kirill Grouchnikov nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030: package org.jvnet.substance.color;
031:
032: import java.awt.Color;
033:
034: import org.jvnet.substance.utils.SubstanceColorUtilities;
035: import org.jvnet.substance.utils.SubstanceCoreUtilities;
036:
037: /**
038: * Implementation of inverted color scheme. Inverted color scheme is based on
039: * some original color scheme, switching the dark colors by light colors and
040: * inverting the foreground color.
041: *
042: * @author Kirill Grouchnikov
043: */
044: public class InvertedColorScheme extends BaseColorScheme {
045: /**
046: * The main ultra-light color.
047: */
048: private Color mainUltraLightColor;
049:
050: /**
051: * The main extra-light color.
052: */
053: private Color mainExtraLightColor;
054:
055: /**
056: * The main light color.
057: */
058: private Color mainLightColor;
059:
060: /**
061: * The main medium color.
062: */
063: private Color mainMidColor;
064:
065: /**
066: * The main dark color.
067: */
068: private Color mainDarkColor;
069:
070: /**
071: * The main ultra-dark color.
072: */
073: private Color mainUltraDarkColor;
074:
075: /**
076: * The foreground color.
077: */
078: private Color foregroundColor;
079:
080: /**
081: * The original color scheme.
082: */
083: private ColorScheme origScheme;
084:
085: /**
086: * Creates a new inverted scheme.
087: *
088: * @param origScheme
089: * The original color scheme.
090: */
091: public InvertedColorScheme(ColorScheme origScheme) {
092: this .origScheme = origScheme;
093: this .foregroundColor = SubstanceColorUtilities
094: .invertColor(origScheme.getForegroundColor());
095: this .mainUltraDarkColor = SubstanceColorUtilities
096: .invertColor(origScheme.getUltraLightColor());
097: this .mainDarkColor = SubstanceColorUtilities
098: .invertColor(origScheme.getExtraLightColor());
099: this .mainMidColor = SubstanceColorUtilities
100: .invertColor(origScheme.getLightColor());
101: this .mainLightColor = SubstanceColorUtilities
102: .invertColor(origScheme.getMidColor());
103: this .mainExtraLightColor = SubstanceColorUtilities
104: .invertColor(origScheme.getDarkColor());
105: this .mainUltraLightColor = SubstanceColorUtilities
106: .invertColor(origScheme.getUltraDarkColor());
107:
108: // this.mainUltraDarkColor = SubstanceColorUtilities
109: // .invertColor(origScheme.getUltraDarkColor());
110: // this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme
111: // .getDarkColor());
112: // this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme
113: // .getMidColor());
114: // this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme
115: // .getLightColor());
116: // this.mainExtraLightColor = SubstanceColorUtilities
117: // .invertColor(origScheme.getExtraLightColor());
118: // this.mainUltraLightColor = SubstanceColorUtilities
119: // .invertColor(origScheme.getUltraLightColor());
120:
121: this .id = "Inverted "
122: + SubstanceCoreUtilities.getSchemeId(origScheme);
123: }
124:
125: /*
126: * (non-Javadoc)
127: *
128: * @see org.jvnet.substance.color.ColorScheme#getForegroundColor()
129: */
130: public Color getForegroundColor() {
131: return this .foregroundColor;
132: }
133:
134: /*
135: * (non-Javadoc)
136: *
137: * @see org.jvnet.substance.color.ColorScheme#getUltraLightColor()
138: */
139: public Color getUltraLightColor() {
140: return this .mainUltraLightColor;
141: }
142:
143: /*
144: * (non-Javadoc)
145: *
146: * @see org.jvnet.substance.color.ColorScheme#getExtraLightColor()
147: */
148: public Color getExtraLightColor() {
149: return this .mainExtraLightColor;
150: }
151:
152: /*
153: * (non-Javadoc)
154: *
155: * @see org.jvnet.substance.color.ColorScheme#getLightColor()
156: */
157: public Color getLightColor() {
158: return this .mainLightColor;
159: }
160:
161: /*
162: * (non-Javadoc)
163: *
164: * @see org.jvnet.substance.color.ColorScheme#getMidColor()
165: */
166: public Color getMidColor() {
167: return this .mainMidColor;
168: }
169:
170: /*
171: * (non-Javadoc)
172: *
173: * @see org.jvnet.substance.color.ColorScheme#getDarkColor()
174: */
175: public Color getDarkColor() {
176: return this .mainDarkColor;
177: }
178:
179: /*
180: * (non-Javadoc)
181: *
182: * @see org.jvnet.substance.color.ColorScheme#getUltraDarkColor()
183: */
184: public Color getUltraDarkColor() {
185: return this .mainUltraDarkColor;
186: }
187:
188: /**
189: * Returns the original color scheme.
190: *
191: * @return The original color scheme.
192: */
193: public ColorScheme getOrigScheme() {
194: return this.origScheme;
195: }
196: }
|