Darken the dark theme, and hover a tree row like a menu
The client's own look-and-feel defaults now live beside LookAndFeelManager as FlatLaf properties files, which FlatLaf loads on top of each theme's own, instead of a handful of UIManager.put calls. The dark theme is built on three surfaces keyed to the toolbar's #282828: the window chrome, the tab strips and menu bar one step below it at #232323, and the content the client shows — channel tree, chat log, text fields, lists — at #1e1e1e. Selections are #364b6f, and channel names in the tree are white; the chat lines about server events keep the blue they had, which channel names no longer carry. Everything FlatLaf derives (borders, scroll bars, hover states) follows from those. A read-only editor pane is a chat log or an information view here, not a disabled input, so it keeps the content background rather than FlatLaf's inactive one; and since neither a text view nor a tree fills its viewport, the space below the last line takes their background instead of the window's. The row under the pointer is now washed in the same colour a hovered menu is, rather than outlined. FlatLaf states that colour as a shift of the surface beneath it, so it is resolved against the window background exactly as the menu bar resolves it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,29 +5,34 @@ import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.FlatLightLaf;
|
||||
import com.ts3client.config.Settings;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
* Installs FlatLaf in the requested variant and keeps {@link Theme} in step with it.
|
||||
*
|
||||
* <p>Also carries the few look-and-feel defaults the client wants everywhere: rounded
|
||||
* controls, a slimmer tree row and scroll bars that only show their thumb.
|
||||
* <p>The client's own look-and-feel defaults — rounded controls, and the darker palette
|
||||
* the dark theme is built on — live beside this class as FlatLaf properties files, which
|
||||
* FlatLaf loads on top of the theme's own.
|
||||
*/
|
||||
public final class LookAndFeelManager {
|
||||
|
||||
/** Where our own FlatLaf properties files sit. */
|
||||
private static final String DEFAULTS_PACKAGE = "com.ts3client.ui.laf";
|
||||
|
||||
static {
|
||||
// Registered once: FlatLaf keeps every registration, and install() runs again on
|
||||
// each theme switch.
|
||||
FlatLaf.registerCustomDefaultsSource(DEFAULTS_PACKAGE);
|
||||
}
|
||||
|
||||
private LookAndFeelManager() {
|
||||
}
|
||||
|
||||
/** Installs the look-and-feel for {@code appearance}. Call before building any window. */
|
||||
public static void install(Settings.Appearance appearance) {
|
||||
FlatLaf laf = appearance == Settings.Appearance.DARK ? new FlatDarkLaf() : new FlatLightLaf();
|
||||
if (!FlatLaf.setup(laf)) {
|
||||
// Leave whatever look-and-feel is installed; Theme falls back to its own palette.
|
||||
Theme.refresh();
|
||||
return;
|
||||
}
|
||||
applyDefaults();
|
||||
// Whatever look-and-feel stays installed on failure, Theme falls back to its own palette.
|
||||
FlatLaf.setup(laf);
|
||||
Theme.refresh();
|
||||
}
|
||||
|
||||
@@ -43,17 +48,4 @@ public final class LookAndFeelManager {
|
||||
w.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyDefaults() {
|
||||
UIManager.put("Component.focusWidth", 1);
|
||||
UIManager.put("Component.arc", 6);
|
||||
UIManager.put("Button.arc", 6);
|
||||
UIManager.put("ScrollBar.showButtons", false);
|
||||
UIManager.put("ScrollBar.thumbArc", 8);
|
||||
UIManager.put("ScrollBar.trackArc", 8);
|
||||
UIManager.put("TabbedPane.tabHeight", 26);
|
||||
UIManager.put("Tree.rowHeight", 0);
|
||||
UIManager.put("Tree.paintLines", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user