java.lang.Object
com.example.cab302project.ThemeManager
Utility class for applying the application's light/dark theme.
The theme is implemented as a CSS class ("dark-mode") added to or removed
from the root node of the current scene. All dark-mode overrides live in
styles.css under the ".dark-mode" parent selector so no stylesheet swap is
needed — a single class toggle is enough.
Call
apply(Scene) after every scene switch (and after any in-screen
toggle) to keep the theme in sync with the active user's preference.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CSS class applied to the scene root when dark mode is active. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapply(javafx.scene.Scene scene) Reads the current user's dark-mode preference fromUserSessionand applies or removes thedark-modeCSS class on the scene's root node accordingly.
-
Field Details
-
DARK_CLASS
The CSS class applied to the scene root when dark mode is active.- See Also:
-
-
Constructor Details
-
ThemeManager
public ThemeManager()
-
-
Method Details
-
apply
public static void apply(javafx.scene.Scene scene) Reads the current user's dark-mode preference fromUserSessionand applies or removes thedark-modeCSS class on the scene's root node accordingly.- Parameters:
scene- The active JavaFXScene. Does nothing if null.
-