Skip to content

Commit

Permalink
[prmr#538] Add dark mode option in menu and add CSS file for dark theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoding7 committed May 23, 2024
1 parent 7f98abc commit 472e74f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/org/jetuml/JetUML.properties
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ view.verbose_tooltips.mnemonic=T
view.autoedit_node.text=Auto Edit Node
view.autoedit_node.mnemonic=A
view.autoedit_node.icon=16x16/document-edit.png
view.dark_mode.text=Dark Mode
view.dark_mode.mnemonic=M
view.dark_mode.icon=16x16/dark-mode.png
view.diagram_size.text=Set Diagram Size
view.diagram_size.mnemonic=D
view.diagram_size.icon=16x16/zoom-fit-width.png
Expand Down
2 changes: 1 addition & 1 deletion src/org/jetuml/application/UserPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class UserPreferences
public enum BooleanPreference
{
showGrid(true), showToolHints(false), autoEditNode(false), verboseToolTips(false),
showTips(true);
showTips(true), darkMode(false);

private boolean aDefault;

Expand Down
8 changes: 8 additions & 0 deletions src/org/jetuml/gui/EditorFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ public EditorFrame(Stage pMainStage)
getSelectedDiagramTab().keyTyped(e.getCharacter());
}
});

getStylesheets().add(getClass().getResource("DarkMode.css").toExternalForm());
getStylesheets().remove(getClass().getResource("DarkMode.css").toExternalForm());
}

/* Returns the subset of pDesiredFormats for which a registered image writer
Expand Down Expand Up @@ -236,6 +239,11 @@ private void createViewMenu(MenuBar pMenuBar)
UserPreferences.instance().getBoolean(BooleanPreference.autoEditNode),
event -> UserPreferences.instance().setBoolean(BooleanPreference.autoEditNode,
((CheckMenuItem) event.getSource()).isSelected())),

factory.createCheckMenuItem("view.dark_mode", false,
UserPreferences.instance().getBoolean(BooleanPreference.darkMode),
event -> UserPreferences.instance().setBoolean(BooleanPreference.darkMode,
((CheckMenuItem) event.getSource()).isSelected())),

factory.createMenuItem("view.diagram_size", false, event -> new DiagramSizeDialog(aMainStage).show()),
factory.createMenuItem("view.font", false, event -> new FontDialog(aMainStage).show()),
Expand Down

0 comments on commit 472e74f

Please sign in to comment.