Add dark mode toggle under User Preferences > Application

- Add darkMode boolean preference to ApplicationPreference (persisted via java.util.prefs)
- Add ToggleSwitch labeled "Dark Mode" to ApplicationPreferenceEditor
- Add ThemeManager singleton that listens for preference updates and applies/removes
  the dark stylesheet to all registered JavaFX Scenes and swaps the Swing LAF
- Add sdrtrunk_dark.css with dark styling for controls, tables, menus, dialogs, charts
- Add FlatLaf dependency for full Swing dark theming (replaces previous OS-specific
  MetalLookAndFeel setup; FlatLaf works cross-platform)
- Register all Stages created in JavaFxWindowManager with the ThemeManager and walk
  Window.getWindows() at apply-time so unregistered dialogs/alerts also pick up the theme
- Add Foojay toolchain resolver to settings.gradle so Gradle can auto-provision JDK 25
This commit is contained in:
Akumas_Coffin_
2026-05-14 18:58:50 +10:00
parent a053315675
commit 61f7330cd2
8 changed files with 756 additions and 21 deletions

View File

@@ -0,0 +1,383 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2026 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
/* sdrtrunk dark theme - applied on top of the default Modena stylesheet. */
.root
{
-fx-base: #2b2b2b;
-fx-background: #2b2b2b;
-fx-control-inner-background: #313335;
-fx-control-inner-background-alt: #3c3f41;
-fx-accent: #4a90d9;
-fx-default-button: #4a90d9;
-fx-focus-color: #4a90d9;
-fx-faint-focus-color: #4a90d922;
-fx-text-fill: #d6d6d6;
-fx-text-base-color: #d6d6d6;
-fx-text-background-color: #d6d6d6;
-fx-mark-color: #d6d6d6;
-fx-mark-highlight-color: #ffffff;
-fx-selection-bar: #214283;
-fx-selection-bar-non-focused: #3a3d3f;
-fx-cell-hover-color: #3a3d3f;
}
.label
{
-fx-text-fill: #d6d6d6;
}
.text
{
-fx-fill: #d6d6d6;
}
.button, .toggle-button, .menu-button, .split-menu-button, .choice-box, .combo-box-base
{
-fx-background-color: #3c3f41, #4a4d4f, #3c3f41, #3c3f41;
-fx-text-fill: #d6d6d6;
}
.button:hover, .toggle-button:hover, .menu-button:hover
{
-fx-background-color: #4a90d9, #5aa0e9, #4a90d9, #3c3f41;
}
.button:armed, .toggle-button:selected
{
-fx-background-color: #214283, #3672c4, #214283, #214283;
-fx-text-fill: #ffffff;
}
.text-field, .text-area, .password-field
{
-fx-background-color: #313335;
-fx-text-fill: #d6d6d6;
-fx-prompt-text-fill: #888888;
-fx-highlight-fill: #214283;
-fx-highlight-text-fill: #ffffff;
}
.text-area .content
{
-fx-background-color: #313335;
}
.scroll-pane, .scroll-pane > .viewport
{
-fx-background-color: #2b2b2b;
}
.scroll-bar
{
-fx-background-color: #2b2b2b;
}
.scroll-bar .thumb
{
-fx-background-color: #555a5e;
-fx-background-radius: 3;
}
.scroll-bar .thumb:hover
{
-fx-background-color: #6a7075;
}
.scroll-bar .increment-button, .scroll-bar .decrement-button
{
-fx-background-color: #2b2b2b;
}
.scroll-bar .increment-arrow, .scroll-bar .decrement-arrow
{
-fx-background-color: #c0c0c0;
}
.menu-bar
{
-fx-background-color: #3c3f41;
}
.menu, .menu-item, .context-menu, .menu-bar > .container > .menu-button
{
-fx-background-color: transparent;
}
.menu-item
{
-fx-background-color: #3c3f41;
}
.menu-item:focused, .menu-item:hover
{
-fx-background-color: #4a90d9;
}
.menu-item .label
{
-fx-text-fill: #d6d6d6;
}
.menu-item:focused .label, .menu-item:hover .label
{
-fx-text-fill: #ffffff;
}
.context-menu
{
-fx-background-color: #3c3f41;
-fx-border-color: #555a5e;
}
.tab-pane > .tab-header-area > .headers-region > .tab
{
-fx-background-color: #3c3f41;
}
.tab-pane > .tab-header-area > .headers-region > .tab:selected
{
-fx-background-color: #2b2b2b;
}
.tab-pane > .tab-header-area > .headers-region > .tab .tab-label
{
-fx-text-fill: #b0b0b0;
}
.tab-pane > .tab-header-area > .headers-region > .tab:selected .tab-label
{
-fx-text-fill: #ffffff;
}
.tab-pane > .tab-header-area
{
-fx-background-color: #2b2b2b;
}
.table-view, .tree-view, .list-view, .tree-table-view
{
-fx-background-color: #2b2b2b;
-fx-control-inner-background: #313335;
-fx-control-inner-background-alt: #353739;
-fx-table-cell-border-color: #3c3f41;
}
.table-view .column-header, .table-view .filler, .table-view .column-header-background,
.tree-table-view .column-header, .tree-table-view .filler, .tree-table-view .column-header-background
{
-fx-background-color: #3c3f41;
}
.table-view .column-header .label, .tree-table-view .column-header .label
{
-fx-text-fill: #d6d6d6;
}
.table-row-cell, .tree-table-row-cell, .list-cell, .tree-cell
{
-fx-text-fill: #d6d6d6;
-fx-background-color: -fx-control-inner-background;
}
.table-row-cell:odd, .tree-table-row-cell:odd, .list-cell:odd, .tree-cell:odd
{
-fx-background-color: -fx-control-inner-background-alt;
}
.table-row-cell:selected, .tree-table-row-cell:selected, .list-cell:selected, .tree-cell:selected
{
-fx-background-color: #214283;
-fx-text-fill: #ffffff;
}
.table-row-cell:filled:hover, .tree-table-row-cell:filled:hover, .list-cell:filled:hover, .tree-cell:filled:hover
{
-fx-background-color: #3a3d3f;
}
.titled-pane > .title
{
-fx-background-color: #3c3f41;
}
.titled-pane > .title > .text
{
-fx-fill: #d6d6d6;
}
.titled-pane > .content
{
-fx-background-color: #2b2b2b;
-fx-border-color: #3c3f41;
}
.separator .line
{
-fx-border-color: #444444;
}
.tooltip
{
-fx-background-color: #3c3f41;
-fx-text-fill: #d6d6d6;
-fx-border-color: #555a5e;
}
.check-box .box, .radio-button .radio
{
-fx-background-color: #3c3f41, #4a4d4f;
}
.check-box:selected .mark, .radio-button:selected .dot
{
-fx-background-color: #ffffff;
}
.toggle-switch
{
-fx-text-fill: #d6d6d6;
}
.toggle-switch > .thumb-area
{
-fx-background-color: #3c3f41;
-fx-border-color: #555a5e;
}
.toggle-switch:selected > .thumb-area
{
-fx-background-color: #4a90d9;
-fx-border-color: #4a90d9;
}
.toggle-switch > .thumb
{
-fx-background-color: #d6d6d6;
}
.spinner
{
-fx-background-color: #313335;
}
.spinner .text-field
{
-fx-background-color: #313335;
-fx-text-fill: #d6d6d6;
}
.spinner .increment-arrow-button, .spinner .decrement-arrow-button
{
-fx-background-color: #3c3f41;
}
.spinner .increment-arrow, .spinner .decrement-arrow
{
-fx-background-color: #d6d6d6;
}
.progress-bar > .track
{
-fx-background-color: #3c3f41;
}
.progress-bar > .bar
{
-fx-background-color: #4a90d9;
}
.combo-box .list-cell, .choice-box .label
{
-fx-text-fill: #d6d6d6;
-fx-background-color: transparent;
}
.combo-box-popup .list-view
{
-fx-background-color: #3c3f41;
-fx-border-color: #555a5e;
}
.hyperlink
{
-fx-text-fill: #6ab0ff;
}
.hyperlink:visited
{
-fx-text-fill: #9683c2;
}
.dialog-pane
{
-fx-background-color: #2b2b2b;
}
.dialog-pane > .button-bar > .container
{
-fx-background-color: #2b2b2b;
}
.dialog-pane .header-panel
{
-fx-background-color: #3c3f41;
}
.dialog-pane .header-panel .label
{
-fx-text-fill: #ffffff;
}
.chart
{
-fx-background-color: #2b2b2b;
}
.chart-plot-background
{
-fx-background-color: #313335;
}
.axis
{
-fx-tick-label-fill: #d6d6d6;
}
.axis-label
{
-fx-text-fill: #d6d6d6;
}
.chart-vertical-grid-lines, .chart-horizontal-grid-lines
{
-fx-stroke: #3c3f41;
}
.chart-legend
{
-fx-background-color: #313335;
-fx-text-fill: #d6d6d6;
}
.chart-title
{
-fx-text-fill: #d6d6d6;
}