187 lines
5.4 KiB
Java
187 lines
5.4 KiB
Java
package envoy.client.ui;
|
|
|
|
import java.awt.Color;
|
|
import java.io.Serializable;
|
|
|
|
/**
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>Theme.java</strong><br>
|
|
* Created: <strong>23 Nov 2019</strong><br>
|
|
*
|
|
* @author Maximilian Käfer
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public class Theme implements Serializable {
|
|
|
|
private static final long serialVersionUID = 141727847527060352L;
|
|
|
|
private String themeName;
|
|
private Color backgroundColor;
|
|
private Color cellColor;
|
|
private Color interactableBackgroundColor;
|
|
private Color userNameColor;
|
|
private Color interactableForegroundColor;
|
|
private Color messageColorChat;
|
|
private Color dateColorChat;
|
|
private Color selectionColor;
|
|
private Color typingMessageColor;
|
|
|
|
/**
|
|
* Initializes a {@link Theme} with all colors relevant to the application GUI.
|
|
*
|
|
* @param themeName the name of the {@link Theme}
|
|
* @param backgroundColor the background color
|
|
* @param cellColor the cell color
|
|
* @param interactableForegroundColor the color of interactable foreground UI
|
|
* elements
|
|
* @param interactableBackgroundColor the color of interactable background UI
|
|
* elements
|
|
* @param messageColorChat the color of chat messages
|
|
* @param dateColorChat the color of chat message metadata
|
|
* @param selectionColor the section color
|
|
* @param typingMessageColor the color of currently typed messages
|
|
* @param userNameColor the color of user names
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Theme(String themeName, Color backgroundColor, Color cellColor, Color interactableForegroundColor, Color interactableBackgroundColor,
|
|
Color messageColorChat, Color dateColorChat, Color selectionColor, Color typingMessageColor, Color userNameColor) {
|
|
|
|
this.themeName = themeName;
|
|
|
|
this.backgroundColor = backgroundColor;
|
|
this.cellColor = cellColor;
|
|
this.interactableForegroundColor = interactableForegroundColor;
|
|
this.interactableBackgroundColor = interactableBackgroundColor;
|
|
this.messageColorChat = messageColorChat;
|
|
this.dateColorChat = dateColorChat;
|
|
this.selectionColor = selectionColor;
|
|
this.typingMessageColor = typingMessageColor;
|
|
this.userNameColor = userNameColor;
|
|
}
|
|
|
|
/**
|
|
* Initializes a {@link Theme} by copying all parameters except for the name
|
|
* from another {@link Theme} instance.
|
|
*
|
|
* @param name the name of the {@link Theme}
|
|
* @param other the {@link Theme} to copy
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Theme(String name, Theme other) {
|
|
this(name, other.backgroundColor, other.cellColor, other.interactableForegroundColor,
|
|
other.interactableBackgroundColor, other.messageColorChat, other.dateColorChat, other.selectionColor,
|
|
other.typingMessageColor, other.userNameColor);
|
|
}
|
|
|
|
/**
|
|
* @return name of the theme
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public String getThemeName() { return themeName; }
|
|
|
|
/**
|
|
* @return interactableForegroundColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getInteractableForegroundColor() { return interactableForegroundColor; }
|
|
|
|
/**
|
|
* @return messageColorChat
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getMessageColorChat() { return messageColorChat; }
|
|
|
|
/**
|
|
* @return dateColorChat
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getDateColorChat() { return dateColorChat; }
|
|
|
|
/**
|
|
* @return selectionColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getSelectionColor() { return selectionColor; }
|
|
|
|
/**
|
|
* @return typingMessageColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getTypingMessageColor() { return typingMessageColor; }
|
|
|
|
/**
|
|
* @return backgroundColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getBackgroundColor() { return backgroundColor; }
|
|
|
|
/**
|
|
* @return cellColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getCellColor() { return cellColor; }
|
|
|
|
/**
|
|
* @return interactableBackgroundColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getInteractableBackgroundColor() { return interactableBackgroundColor; }
|
|
|
|
/**
|
|
* @return userNameColor
|
|
* @since Envoy v0.2-alpha
|
|
*/
|
|
public Color getUserNameColor() { return userNameColor; }
|
|
|
|
/**
|
|
* Sets the a specific {@link Color} in this theme to a new {@link Color}
|
|
*
|
|
* @param index - index of the color </br>
|
|
* 0 = backgroundColor </br>
|
|
* 1 = cellColor </br>
|
|
* 2 = interactableForegroundColor </br>
|
|
* 3 = interactableBackgroundColor </br>
|
|
* 4 = messageColorChat </br>
|
|
* 5 = dateColorChat </br>
|
|
* 6 = selectionColor </br>
|
|
* 7 = typingMessageColor </br>
|
|
* 8 = userNameColor </br>
|
|
* </br>
|
|
*
|
|
* @param newColor - new {@link Color} to be set
|
|
* @since Envoy 0.2-alpha
|
|
*/
|
|
public void setColor(int index, Color newColor) {
|
|
switch (index) {
|
|
case 0:
|
|
backgroundColor = newColor;
|
|
break;
|
|
case 1:
|
|
cellColor = newColor;
|
|
break;
|
|
case 2:
|
|
interactableForegroundColor = newColor;
|
|
break;
|
|
case 3:
|
|
interactableBackgroundColor = newColor;
|
|
break;
|
|
case 4:
|
|
messageColorChat = newColor;
|
|
break;
|
|
case 5:
|
|
dateColorChat = newColor;
|
|
break;
|
|
case 6:
|
|
selectionColor = newColor;
|
|
break;
|
|
case 7:
|
|
typingMessageColor = newColor;
|
|
break;
|
|
case 8:
|
|
userNameColor = newColor;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|