This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/client/ui/UIColors.java

123 lines
3.7 KiB
Java

package envoy.client.ui;
import java.awt.Color;
/**
* This class stores the colors that are used in Envoy.
* <br>
* <br>
* Project: <strong>envoy-client</strong><br>
* File: <strong>EnvoyColors.java</strong><br>
* Created: <strong>16 Nov 2019</strong><br>
*
* @author Leon Hofmeister
* @since Envoy v0.2-alpha
*/
public class UIColors {
private UIColors() {}
private Color backgroundColor;
private Color userInteractionColor;
private Color specialUseColor;
private Color textColor;
private static UIColors uIColors;
/**
* This method is used to ensure that there is only one instance of EnvoyColors.
*
* @param darkMode default value how envoyColors should be displayed
* @return the instance of EnvoyColors
* @since Envoy v0.2-alpha
*/
public static UIColors getInstance(boolean darkMode) {
if (uIColors == null) { uIColors = new UIColors(); }
uIColors.setDisplayMode(darkMode);
return uIColors;
}
/**
* Used to change the appearance of Envoy.
*
* @param darkMode if true, Envoy will be displayed in dark mode else it will
* use bright mode
* @since Envoy v0.2-alpha
*/
public void setDisplayMode(boolean darkMode) {
if (darkMode) {
uIColors.setBackgroundColor(Color.black); // TODO: other color suggestions?
uIColors.setUserInteractionColor(Color.darkGray); // temporary
uIColors.setSpecialUseColor(Color.blue); // temporary
uIColors.setTextColor(Color.white); // temporary
} else {
uIColors.setBackgroundColor(Color.white); // temporary
uIColors.setUserInteractionColor(Color.lightGray); // temporary
uIColors.setSpecialUseColor(Color.green); // temporary
uIColors.setTextColor(Color.black); // temporary
}
}
/**
* @return the general background color where no other element overlaps
* @since Envoy v0.2-alpha
*/
public Color getBackgroundColor() { return backgroundColor; }
/**
* @param backgroundColor the general background where no other element overlaps
* @since Envoy v0.2-alpha
*/
public void setBackgroundColor(Color backgroundColor) { this.backgroundColor = backgroundColor; }
/**
* @return the userInteractionColor:<br>
* This color is used as background for all areas where a user can
* interact with Envoy (i.e. a JTextArea or JList)
* @since Envoy v0.2-alpha
*/
public Color getUserInteractionColor() { return userInteractionColor; }
/**
* @param userInteractionColor This color is used as background for all areas <br>
* where a user can interact with Envoy
* (i.e. a JTextArea or JList)
* @since Envoy v0.2-alpha
*/
public void setUserInteractionColor(Color userInteractionColor) {
this.userInteractionColor = userInteractionColor;
}
/**
* @return specialUseColor: This color is used for any areas that need special attention.<br>
* (i.e. highlighting a selected list column or a button background)
* @since Envoy v0.2-alpha
*/
public Color getSpecialUseColor() { return specialUseColor; }
/**
* @param specialUseColor This color is used for any areas that need special attention.<br>
* (i.e. highlighting a selected list column or a button background)
* @since Envoy v0.2-alpha
*/
public void setSpecialUseColor(Color specialUseColor) { this.specialUseColor = specialUseColor; }
/**
* @return textColor: The color in which text will be displayed
* @since Envoy v0.2-alpha
*/
public Color getTextColor() { return textColor; }
/**
* @param textColor The color in which text will be displayed
* @since Envoy v0.2-alpha
*/
public void setTextColor(Color textColor) { this.textColor = textColor; }
/**
* @return the uiColors object
* @since Envoy v0.2-alpha
*/
public static UIColors getUIColors() { return uIColors; }
}