diff --git a/src/main/java/envoy/client/data/Settings.java b/src/main/java/envoy/client/data/Settings.java
index 3b1718c..c8bed6a 100644
--- a/src/main/java/envoy/client/data/Settings.java
+++ b/src/main/java/envoy/client/data/Settings.java
@@ -83,7 +83,7 @@ public class Settings {
* @return the name of the currently active theme
* @since Envoy Client v0.2-alpha
*/
- public String getCurrentThemeName() { return (String) items.get("currentTheme").get(); }
+ public String getCurrentTheme() { return (String) items.get("currentTheme").get(); }
/**
* Sets the name of the current theme.
diff --git a/src/main/java/envoy/client/ui/SceneContext.java b/src/main/java/envoy/client/ui/SceneContext.java
index 3149b4d..a8986f4 100644
--- a/src/main/java/envoy/client/ui/SceneContext.java
+++ b/src/main/java/envoy/client/ui/SceneContext.java
@@ -92,7 +92,7 @@ public final class SceneContext {
private void applyCSS() {
if (!sceneStack.isEmpty()) {
final var styleSheets = stage.getScene().getStylesheets();
- final var themeCSS = "/css/" + settings.getCurrentThemeName() + ".css";
+ final var themeCSS = "/css/" + settings.getCurrentTheme() + ".css";
styleSheets.clear();
styleSheets.addAll(getClass().getResource("/css/base.css").toExternalForm(), getClass().getResource(themeCSS).toExternalForm());
}
diff --git a/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java b/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java
index 6c561f0..12cbaf5 100644
--- a/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java
+++ b/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java
@@ -2,10 +2,13 @@ package envoy.client.ui.settings;
import java.util.List;
+import javafx.scene.control.ComboBox;
import javafx.scene.layout.VBox;
import envoy.client.data.Settings;
import envoy.client.data.SettingsItem;
+import envoy.client.event.ThemeChangeEvent;
+import envoy.event.EventBus;
/**
* Project: envoy-client
@@ -30,8 +33,17 @@ public class GeneralSettingsPane extends SettingsPane {
List.of("onCloseMode", "enterToSend")
.stream()
.map(settings.getItems()::get)
- .map(i -> new SettingsToggleButton((SettingsItem) i))
+ .map(i -> new SettingsCheckbox((SettingsItem) i))
.forEach(vbox.getChildren()::add);
+
+ var combobox = new ComboBox();
+ combobox.getItems().add("dark");
+ combobox.getItems().add("light");
+ combobox.setValue(settings.getCurrentTheme());
+ combobox.setOnAction(
+ e -> { settings.setCurrentTheme(combobox.getValue()); EventBus.getInstance().dispatch(new ThemeChangeEvent(combobox.getValue())); });
+ vbox.getChildren().add(combobox);
+
getChildren().add(vbox);
}
}
diff --git a/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java b/src/main/java/envoy/client/ui/settings/SettingsCheckbox.java
similarity index 65%
rename from src/main/java/envoy/client/ui/settings/SettingsToggleButton.java
rename to src/main/java/envoy/client/ui/settings/SettingsCheckbox.java
index 767f44d..b672d5a 100644
--- a/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java
+++ b/src/main/java/envoy/client/ui/settings/SettingsCheckbox.java
@@ -1,7 +1,7 @@
package envoy.client.ui.settings;
import javafx.event.ActionEvent;
-import javafx.scene.control.ToggleButton;
+import javafx.scene.control.CheckBox;
import envoy.client.data.SettingsItem;
@@ -13,20 +13,20 @@ import envoy.client.data.SettingsItem;
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta
*/
-public final class SettingsToggleButton extends ToggleButton {
+public final class SettingsCheckbox extends CheckBox {
/**
- * Creates an instance of {@link SettingsToggleButton}.
+ * Creates an instance of {@link SettingsCheckbox}.
*
* @param settingsItem the {@link SettingsItem} whose values could be adapted
* @since Envoy Client v0.1-beta
*/
- public SettingsToggleButton(SettingsItem settingsItem) {
+ public SettingsCheckbox(SettingsItem settingsItem) {
super(settingsItem.getUserFriendlyName());
setSelected(settingsItem.get());
// "Schau, es hat sich behindert" - Kai, 2020
- addEventHandler(ActionEvent.ACTION, e -> settingsItem.set(!settingsItem.get()));
+ addEventHandler(ActionEvent.ACTION, e -> settingsItem.set(isSelected()));
}
}
diff --git a/src/main/resources/css/base.css b/src/main/resources/css/base.css
index a2728c5..eeff6ef 100644
--- a/src/main/resources/css/base.css
+++ b/src/main/resources/css/base.css
@@ -1,5 +1,3 @@
-* {
- /* -fx-font: 14.0pt "Serif";
- -fx-background-color:#000000; */
- -fx-opacity:1;
+.button {
+ -fx-background-radius: 5em;
}
diff --git a/src/main/resources/css/dark.css b/src/main/resources/css/dark.css
index 06326dd..4a899b2 100644
--- a/src/main/resources/css/dark.css
+++ b/src/main/resources/css/dark.css
@@ -1,7 +1,4 @@
-.root{
- --background=#000000;
- background: var(--background);
-}
.button{
- color: rgb(105,0,153);
+ -fx-background-color: rgb(105,0,153);
+ -fx-text-fill: white;
}
\ No newline at end of file
diff --git a/src/main/resources/css/light.css b/src/main/resources/css/light.css
index e69de29..a529c0f 100644
--- a/src/main/resources/css/light.css
+++ b/src/main/resources/css/light.css
@@ -0,0 +1,3 @@
+.button{
+ -fx-background-color: snow;
+}
\ No newline at end of file