X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjexer%2Fbits%2FColor.java;h=4defed5cfad7b35af25e901f2a165612b037fb71;hb=e6bb1700749980e69b5e913acbfd276f129c24dc;hp=dd3b93de18c72dd2005e1a5bd01e45f02aca7f77;hpb=4328bb42c10743287dad5cf045f059ad109eb540;p=fanfix.git diff --git a/src/jexer/bits/Color.java b/src/jexer/bits/Color.java deleted file mode 100644 index dd3b93d..0000000 --- a/src/jexer/bits/Color.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Jexer - Java Text User Interface - * - * Version: $Id$ - * - * Author: Kevin Lamonte, kevin.lamonte@gmail.com - * - * License: LGPLv3 or later - * - * Copyright: This module is licensed under the GNU Lesser General - * Public License Version 3. Please see the file "COPYING" in this - * directory for more information about the GNU Lesser General Public - * License Version 3. - * - * Copyright (C) 2015 Kevin Lamonte - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see - * http://www.gnu.org/licenses/, or write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -package jexer.bits; - -/** - * A text cell color. - */ -public class Color { - - /** - * The color value. Default is WHITE. - */ - public int value = 7; - - /** - * Public constructor - */ - public Color(int value) { - this.value = value; - } - - // The color integer values. NOT EXPOSED. - static private final int black = 0; - static private final int red = 1; - static private final int green = 2; - static private final int yellow = 3; - static private final int blue = 4; - static private final int magenta = 5; - static private final int cyan = 6; - static private final int white = 7; - - /** - * Black. Bold + black = dark grey - */ - static public final Color BLACK = new Color(black); - - /** - * Red - */ - static public final Color RED = new Color(red); - - /** - * Green - */ - static public final Color GREEN = new Color(green); - - /** - * Yellow. Sometimes not-bold yellow is brown. - */ - static public final Color YELLOW = new Color(yellow); - - /** - * Blue - */ - static public final Color BLUE = new Color(blue); - - /** - * Magenta (purple) - */ - static public final Color MAGENTA = new Color(magenta); - - /** - * Cyan (blue-green) - */ - static public final Color CYAN = new Color(cyan); - - /** - * White - */ - static public final Color WHITE = new Color(white); - - /** - * Invert a color in the same way as (CGA/VGA color XOR 0x7). - * @return the inverted color - */ - public Color invert() { - switch (value) { - case black: - return Color.WHITE; - case white: - return Color.BLACK; - case red: - return Color.CYAN; - case cyan: - return Color.RED; - case green: - return Color.MAGENTA; - case magenta: - return Color.GREEN; - case blue: - return Color.YELLOW; - case yellow: - return Color.BLUE; - } - throw new IllegalArgumentException("Invalid Color value: " + - value); - } - - /** - * Comparison. All fields must match to return true. - */ - @Override - public boolean equals(Object rhs) { - if (!(rhs instanceof Color)) { - return false; - } - - Color that = (Color)rhs; - return (value == that.value); - } -}