diff --git a/pom.xml b/pom.xml index b31178b..22f7453 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ loper LogiLedus - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/src/main/java/logiledus/About/AboutWindow.java b/src/main/java/logiledus/About/AboutWindow.java index 9ba36ca..fb07ccc 100644 --- a/src/main/java/logiledus/About/AboutWindow.java +++ b/src/main/java/logiledus/About/AboutWindow.java @@ -5,6 +5,7 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; +import logiledus.Mediator; import java.io.IOException; import java.util.Locale; @@ -35,8 +36,9 @@ public class AboutWindow { new Image(getClass().getResourceAsStream("/ico/appIcon_64.png")), new Image(getClass().getResourceAsStream("/ico/appIcon_128.png")) ); - stageAbout.setScene(new Scene(parentAbout, 500, 500)); - + Scene scene = new Scene(parentAbout, 500, 500); + scene.getStylesheets().add(Mediator.getInstance().getPreferences().getTheme()); + stageAbout.setScene(scene); stageAbout.show(); } catch (IOException ignored){} diff --git a/src/main/java/logiledus/AppPreferences.java b/src/main/java/logiledus/AppPreferences.java index fdc8ca4..bb8b58b 100644 --- a/src/main/java/logiledus/AppPreferences.java +++ b/src/main/java/logiledus/AppPreferences.java @@ -14,12 +14,6 @@ public class AppPreferences { public void setUseTray(boolean value){ preferences.putBoolean("USE_TRAY", value); } public boolean getUseTray(){ return preferences.getBoolean("USE_TRAY", true); } -/* - public void setPath(String path){ - preferences.put("PATH", path); - } - public String getPath(){ - return preferences.get("PATH", "/"); - } -*/ + public void setTheme(String value){ preferences.put("THEME", value); } + public String getTheme(){ return preferences.get("THEME", "/light.css"); } } diff --git a/src/main/java/logiledus/MainFx.java b/src/main/java/logiledus/MainFx.java index ccb295b..4beaec9 100644 --- a/src/main/java/logiledus/MainFx.java +++ b/src/main/java/logiledus/MainFx.java @@ -16,7 +16,7 @@ import java.util.Locale; import java.util.ResourceBundle; public class MainFx extends Application { - public static final String appVersion = "v1.0"; + public static final String appVersion = "v1.1"; private static boolean traySupport = true; @@ -38,9 +38,6 @@ public class MainFx extends Application { SwingUtilities.invokeLater(this::addAppToTray); } //-------------------------------------------------------- - Mediator.getInstance().setHostServices(getHostServices()); - Mediator.getInstance().setPreferences(appPreferences); - FXMLLoader loader = new FXMLLoader(getClass().getResource("/Main.fxml")); Locale locale = new Locale(Locale.getDefault().getISO3Language()); @@ -78,7 +75,12 @@ public class MainFx extends Application { primaryStage.setMinWidth(1215); primaryStage.setMinHeight(550); Scene mainScene = new Scene(root, 1215, 525); - mainScene.getStylesheets().add("/light.css"); + mainScene.getStylesheets().add(appPreferences.getTheme()); + + Mediator.getInstance().setHostServices(getHostServices()); + Mediator.getInstance().setPreferences(appPreferences); + Mediator.getInstance().setScene(mainScene); + primaryStage.setScene(mainScene); primaryStage.show(); diff --git a/src/main/java/logiledus/Mediator.java b/src/main/java/logiledus/Mediator.java index b1f20a8..2c471d7 100644 --- a/src/main/java/logiledus/Mediator.java +++ b/src/main/java/logiledus/Mediator.java @@ -1,16 +1,19 @@ package logiledus; import javafx.application.HostServices; +import javafx.scene.Scene; public class Mediator{ private HostServices hostServices; private AppPreferences preferences; + private Scene scene; public static Mediator getInstance(){ return MediatorHolder.INSTANCE; } public void setHostServices(HostServices hostServices){ this.hostServices = hostServices; } public void setPreferences(AppPreferences preferences){ this.preferences = preferences; } + public void setScene(Scene scene){ this.scene = scene; } private static class MediatorHolder{ private static final Mediator INSTANCE = new Mediator(); @@ -18,4 +21,9 @@ public class Mediator{ public HostServices getHostServices() { return hostServices; } public AppPreferences getPreferences() { return preferences; } + + public void setTheme(String themeString){ + scene.getStylesheets().remove(0); + scene.getStylesheets().add(themeString); + } } \ No newline at end of file diff --git a/src/main/java/logiledus/Settings/SettingsController.java b/src/main/java/logiledus/Settings/SettingsController.java index 5d24f2d..3992ea2 100644 --- a/src/main/java/logiledus/Settings/SettingsController.java +++ b/src/main/java/logiledus/Settings/SettingsController.java @@ -16,16 +16,26 @@ public class SettingsController implements Initializable { private Button cancelBtn, okBtn; @FXML - private CheckBox trayCB; + private CheckBox trayCB, drkThemeCB; @Override public void initialize(URL url, ResourceBundle resourceBundle) { trayCB.setSelected(Mediator.getInstance().getPreferences().getUseTray()); + if (Mediator.getInstance().getPreferences().getTheme().equals("/dark.css")) + drkThemeCB.setSelected(true); cancelBtn.setOnAction(actionEvent -> ((Stage) cancelBtn.getScene().getWindow()).close()); okBtn.setOnAction(actionEvent -> { Mediator.getInstance().getPreferences().setUseTray(trayCB.isSelected()); + if (drkThemeCB.isSelected()) { + Mediator.getInstance().getPreferences().setTheme("/dark.css"); + Mediator.getInstance().setTheme("/dark.css"); + } + else { + Mediator.getInstance().getPreferences().setTheme("/light.css"); + Mediator.getInstance().setTheme("/light.css"); + } ((Stage) cancelBtn.getScene().getWindow()).close(); }); diff --git a/src/main/java/logiledus/Settings/SettingsWindow.java b/src/main/java/logiledus/Settings/SettingsWindow.java index ed02c3f..7afade4 100644 --- a/src/main/java/logiledus/Settings/SettingsWindow.java +++ b/src/main/java/logiledus/Settings/SettingsWindow.java @@ -5,6 +5,7 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; +import logiledus.Mediator; import java.io.IOException; import java.util.Locale; @@ -35,7 +36,9 @@ public class SettingsWindow { new Image(getClass().getResourceAsStream("/ico/appIcon_64.png")), new Image(getClass().getResourceAsStream("/ico/appIcon_128.png")) ); - stageAbout.setScene(new Scene(parentAbout, 500, 500)); + Scene scene = new Scene(parentAbout, 500, 500); + scene.getStylesheets().add(Mediator.getInstance().getPreferences().getTheme()); + stageAbout.setScene(scene); stageAbout.show(); diff --git a/src/main/resources/EffectsPane.fxml b/src/main/resources/EffectsPane.fxml index ce26635..f515bd0 100644 --- a/src/main/resources/EffectsPane.fxml +++ b/src/main/resources/EffectsPane.fxml @@ -1,16 +1,9 @@ - - - - - - - + - diff --git a/src/main/resources/Main.fxml b/src/main/resources/Main.fxml index 36e15ba..f00341a 100644 --- a/src/main/resources/Main.fxml +++ b/src/main/resources/Main.fxml @@ -9,6 +9,7 @@ + @@ -33,7 +34,7 @@ - + @@ -41,7 +42,7 @@ - + @@ -51,7 +52,7 @@ - + @@ -71,57 +72,64 @@ - - - - - - - - - + + + + + + + + + + diff --git a/src/main/resources/SettingsLayout.fxml b/src/main/resources/SettingsLayout.fxml index 0bca1f6..36b5d57 100644 --- a/src/main/resources/SettingsLayout.fxml +++ b/src/main/resources/SettingsLayout.fxml @@ -17,9 +17,10 @@
- + +
diff --git a/src/main/resources/dark.css b/src/main/resources/dark.css new file mode 100644 index 0000000..0a866e2 --- /dev/null +++ b/src/main/resources/dark.css @@ -0,0 +1,299 @@ +.root{ + -fx-background: #2b2b2b; +} + +.tool-bar{ + -fx-background-color: #2b2b2b; +} +/* -======================== Buttons =====================- */ +.button SVGPath{ + -fx-fill: #ebebeb; +} +.button, .toggle-button, .menu-button { + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-border-color: #47ca60; + -fx-border-radius: 2; + -fx-border-width: 2; + -fx-text-fill: #ebebeb; + //-fx-effect: dropshadow(three-pass-box, #dadada, 2, 0, 0, 0); +} +.menu-button:hover, .button:hover, .choice-box:hover, .menu-button:focused:hover, .button:focused:hover, .choice-box:focused:hover, .toggle-button:hover, .toggle-button:focused:hover{ + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-border-color: #4a81dd; + -fx-border-radius: 2; + -fx-border-width: 2; + -fx-text-fill: #ebebeb; + //-fx-effect: dropshadow(three-pass-box, #4a81dd, 2, 0, 0, 0); +} +.menu-button:focused, .button:focused, .choice-box:focused, .toggle-button:focused{ + -fx-background-color: #4b4e51; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-border-color: #4c7352; + -fx-border-radius: 2; + -fx-border-width: 2; + -fx-text-fill: #ebebeb; + //-fx-effect: dropshadow(three-pass-box, #dadada, 2, 0, 0, 0); +} + +.menu-button:pressed, .button:pressed, .menu-button:pressed:hover, .button:pressed:hover, .toggle-button:pressed, .toggle-button:pressed:hover{ + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-border-color: #e82382; + -fx-border-radius: 2; + -fx-border-width: 2; + -fx-text-fill: #ebebeb; + //-fx-effect: dropshadow(three-pass-box, #e82382, 2, 0, 0, 0); +} +/* -======================== Buttons keys =====================- */ +.toggle-button:selected, .toggle-button:selected:hover{ + -fx-background-color: #214131; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 8; + -fx-border-color: #ccfed1; + -fx-border-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + //-fx-effect: dropshadow(three-pass-box, #dadada, 2, 0, 0, 0); +} + +.button_keycap, .toggle-button_keycap { + -fx-background-color: #3c3f41; + -fx-background-radius: 8; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #cfcfcf; + -fx-border-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #8f8f8f, 1, 0, 0, 0); +} +.button_keycap:hover, .button_keycap:focused:hover, .toggle-button_keycap:hover, .toggle-button_keycap:focused:hover{ + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #4a81dd; + -fx-border-radius: 8; + -fx-background-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #4a81dd, 2, 0, 0, 0); +} +.button_keycap:focused, .toggle-button_keycap:focused{ + -fx-background-color: #dadada; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #8f8f8f; + -fx-border-radius: 8; + -fx-background-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #8f8f8f, 1, 0, 0, 0); +} + +.button_keycap:pressed, .button_keycap:pressed:hover, .toggle-button_keycap:pressed, .toggle-button_keycap:pressed:hover{ + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #e82382; + -fx-border-radius: 8; + -fx-background-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #e82382, 2, 0, 0, 0); +} + +.toggle-button_keycap:selected, .toggle-button_keycap:selected:hover{ + -fx-background-color: #214131; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #ccfed1; + -fx-border-radius: 8; + -fx-background-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: none; +} + +.always_off_button:disabled, .always_off_button:disabled:selected { + -fx-opacity: 1.0; + -fx-background-color: #412441; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-border-color: #f1cbf1; + -fx-border-radius: 8; + -fx-background-radius: 8; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #f1cbf1, 1, 0, 0, 0); +} +/* -======================== TextArea =====================- */ +.text-area{ + -fx-background-color: transparent; + -fx-control-inner-background: #3c3f41; + -fx-border-color: #06b9bb; + -fx-border-radius: 3; + -fx-border-width: 1; + -fx-text-fill: #ebebeb; +} + +.progress-bar { + -fx-background-color: transparent; + -fx-box-border: transparent; +} +.progress-bar > .track { + -fx-background-color: transparent; + -fx-box-border: transparent; +} +.progress-bar > .bar { + -fx-background-color: linear-gradient(to right, #00bce4, #ff5f53); + -fx-background-radius: 2; + -fx-background-insets: 1 1 2 1; + -fx-padding: 0.23em; +} + +.dialog-pane { + -fx-background-color: #3c3f41; +} +.dialog-pane > .button-bar > .container{ + -fx-background-color: #2b2b2b; +} + +.dialog-pane > .label{ + -fx-padding: 10 5 10 5; +} + +/* -======================== ToolBar =========================- */ +/* +.tool-bar{ + -fx-background-color: transparent; +} +*/ +/* -======================== Choice box =========================- */ +.choice-box { + -fx-background-color: #3c3f41; + -fx-border-color: #3c3f41; + -fx-border-radius: 3; + -fx-border-width: 2; + -fx-mark-color: #eea11e; + -fx-effect: dropshadow(three-pass-box, #b4b4b4, 2, 0, 0, 0); +} +.choice-box > .label { + -fx-text-fill: #ebebeb; +} + +.choice-box:pressed, .choice-box:pressed:hover{ + -fx-background-color: #3c3f41; + -fx-border-color: #eea11e; + -fx-border-radius: 3; + -fx-border-width: 2; + -fx-text-fill: #ebebeb; + -fx-effect: dropshadow(three-pass-box, #eea11e, 2, 0, 0, 0); +} + +// Background color of the whole context menu +.choice-box .context-menu { + -fx-background-color: #3c3f41; +} + +// Focused item background color in the list +.choice-box .context-menu .menu-item:focused { + -fx-background-color: #eea11e; + +} +.choice-box .context-menu .menu-item:focused .label { + -fx-text-fill: #ebebeb; +} + +/* -======================== TAB PANE =========================- */ +.tab-pane .tab SVGPath{ + -fx-fill: #ebebeb; +} +.tab-pane .tab:selected SVGPath, .tab-pane .tab:selected:hover SVGPath{ + -fx-fill: #ebebeb; +} +.tab-pane .tab:hover SVGPath{ + -fx-fill: #d0d0d0; +} +.tab-pane .tab{ + -fx-background-color: #3c3f41; /* #2b2b2b; */ + -fx-focus-color: transparent; + -fx-faint-focus-color: transparent; + -fx-border-radius: 0 0 0 0; + -fx-border-width: 0 0 3 0; + -fx-border-color: #2b2b2b; +} + +.tab-pane .tab:selected{ + -fx-background-color: #3c3f41;/*#2b2b2b; */ + -fx-focus-color: transparent; + -fx-faint-focus-color: transparent; + -fx-border-radius: 0 0 0 0; + -fx-border-width: 0 0 3 0; + -fx-border-color: #40b9bb; /* #289de8; */ +} + +.tab-pane > .tab-header-area { + -fx-background-insets: 0.0; + -fx-padding: 5 5 5 5; +} + +.tab-pane > .tab-header-area > .tab-header-background +{ + -fx-background-color: #2b2b2b; + +} +.tab-pane > .tab-header-area > .headers-region > .tab { + -fx-padding: 10; +} +/* -========================== Context menu =====================- */ +.menu-button .label { + -fx-text-fill: #ebebeb; +} + +.menu-button .arrow { + -fx-background-color: #ebebeb; +} + +.context-menu { + -fx-background-color: #3c3f41; + -fx-cursor: hand; +} +.context-menu .menu-item .label { + -fx-text-fill: #ebebeb; +} +.context-menu .menu-item:focused .label { + -fx-text-fill: white; +} +/* -========================== Text Field =====================- */ +.text-field { + -fx-border-color: #289de8; + -fx-border-width: 0 0 1 0; + -fx-background-color: transparent; + -fx-text-fill: #ebebeb; +} +.text-field:focused { + -fx-border-color: #e82382; + -fx-border-width: 0 0 1 0; + -fx-background-color: transparent; + -fx-text-fill: #e82382; +} +/* -========================== footer pane =====================- */ +.footer{ + -fx-background-color: #3c3f41; + -fx-border-color: #ebebeb; + -fx-border-width: 1 0 0 0; +} +/* -========================== header pane =====================- */ +.header { + -fx-background-image: url("pttrn_drk.png"); + -fx-background-position: center; + -fx-background-repeat: repeat; + -fx-border-color: #b5b5b5; + -fx-border-width: 0 0 1 0; +} +.header-box { + -fx-background-color: #3c3f41; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-padding: 3.5; +} \ No newline at end of file diff --git a/src/main/resources/light.css b/src/main/resources/light.css index 032ad67..005a434 100644 --- a/src/main/resources/light.css +++ b/src/main/resources/light.css @@ -46,18 +46,18 @@ -fx-text-fill: #2c2c2c; //-fx-effect: dropshadow(three-pass-box, #e82382, 2, 0, 0, 0); } - +/* -======================== Buttons keys =====================- */ .toggle-button:selected, .toggle-button:selected:hover{ -fx-background-color: #e1feeb; -fx-background-insets: 0 0 0 0, 0, 1, 2; - -fx-background-radius: 2; + -fx-background-radius: 8; -fx-border-color: #ccfed1; - -fx-border-radius: 2; - -fx-border-width: 2; + -fx-border-radius: 8; + -fx-border-width: 1; -fx-text-fill: #2c2c2c; - //-fx-effect: dropshadow(three-pass-box, #dadada, 2, 0, 0, 0); + -fx-effect: dropshadow(three-pass-box, #dadada, 2, 0, 0, 0); } -/* -======================== Buttons keys =====================- */ + .button_keycap, .toggle-button_keycap { -fx-background-color: #fefefe; -fx-background-radius: 8; @@ -108,7 +108,7 @@ -fx-background-radius: 8; -fx-border-width: 1; -fx-text-fill: #2c2c2c; - -fx-effect: none; + -fx-effect: dropshadow(three-pass-box, #e82382, 2, 0, 0, 0); } .always_off_button:disabled, .always_off_button:disabled:selected { @@ -128,7 +128,7 @@ -fx-control-inner-background: #fefefe; -fx-border-color: #06b9bb; -fx-border-radius: 3; - -fx-border-width: 2; + -fx-border-width: 1; -fx-text-fill: #2c2c2c; } @@ -215,16 +215,16 @@ -fx-focus-color: transparent; -fx-faint-focus-color: transparent; -fx-border-radius: 0 0 0 0; - -fx-border-width: 3 0 0 0; + -fx-border-width: 0 0 3 0; -fx-border-color: #fefefe; } .tab-pane .tab:selected{ - -fx-background-color: #ebebeb; + -fx-background-color: #fefefe; -fx-focus-color: transparent; -fx-faint-focus-color: transparent; -fx-border-radius: 0 0 0 0; - -fx-border-width: 3 0 0 0; + -fx-border-width: 0 0 3 0; -fx-border-color: #40b9bb; /* #289de8; */ } @@ -235,7 +235,7 @@ .tab-pane > .tab-header-area > .tab-header-background { - -fx-background-color: #fefefe; + -fx-background-color: #ebebeb; } .tab-pane > .tab-header-area > .headers-region > .tab { @@ -278,4 +278,11 @@ -fx-background-repeat: repeat; -fx-border-color: #b5b5b5; -fx-border-width: 0 0 1 0; +} + +.header-box { + -fx-background-color: #ebebeb; + -fx-background-insets: 0 0 0 0, 0, 1, 2; + -fx-background-radius: 2; + -fx-padding: 3.5; } \ No newline at end of file diff --git a/src/main/resources/locale.properties b/src/main/resources/locale.properties index 419f3d5..277b487 100644 --- a/src/main/resources/locale.properties +++ b/src/main/resources/locale.properties @@ -705,3 +705,4 @@ setting_tray_support=Minimize to tray setting_save_and_close=Save and close setting_cancel=Cancel open=Open +setting_use_dark_theme=Use dark theme diff --git a/src/main/resources/locale_rus.properties b/src/main/resources/locale_rus.properties index 5a0e9c1..5268bef 100644 --- a/src/main/resources/locale_rus.properties +++ b/src/main/resources/locale_rus.properties @@ -31,3 +31,4 @@ setting_tray_support=\u0421\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u044 setting_cancel=\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C setting_save_and_close=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438 \u0437\u0430\u043A\u0440\u044B\u0442\u044C open=\u041E\u0442\u043A\u0440\u044B\u0442\u044C +setting_use_dark_theme=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0442\u0451\u043C\u043D\u0443\u044E \u0442\u0435\u043C\u0443 diff --git a/src/main/resources/pttrn_drk.png b/src/main/resources/pttrn_drk.png new file mode 100644 index 0000000..4e6fee5 Binary files /dev/null and b/src/main/resources/pttrn_drk.png differ