Class ThemeManager

java.lang.Object
com.example.cab302project.ThemeManager

public class ThemeManager extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The CSS class applied to the scene root when dark mode is active.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    apply(javafx.scene.Scene scene)
    Reads the current user's dark-mode preference from UserSession and applies or removes the dark-mode CSS class on the scene's root node accordingly.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DARK_CLASS

      public static final String 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 from UserSession and applies or removes the dark-mode CSS class on the scene's root node accordingly.
      Parameters:
      scene - The active JavaFX Scene. Does nothing if null.