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:
@@ -3,6 +3,7 @@ package com.ts3client.ui;
|
||||
import com.ts3client.text.BBCode;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
@@ -42,6 +43,17 @@ final class HtmlStyles {
|
||||
return pane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the scroll pane {@code pane} sits in with the pane's own background: text
|
||||
* only reaches as far as it goes, and the empty space below it would otherwise show
|
||||
* the window's colour instead of the log's.
|
||||
*/
|
||||
static void fillViewport(JEditorPane pane) {
|
||||
if (pane.getParent() instanceof JViewport viewport) {
|
||||
viewport.setBackground(pane.getBackground());
|
||||
}
|
||||
}
|
||||
|
||||
/** Re-themes {@code pane}, keeping the text it shows. */
|
||||
private static void restyle(JEditorPane pane) {
|
||||
// Also runs from JEditorPane's constructor, before the pane is one of ours.
|
||||
@@ -68,7 +80,7 @@ final class HtmlStyles {
|
||||
// about what happened on the server.
|
||||
css.addRule(".muted { color:" + hex(Theme.chatSystem()) + "; }");
|
||||
css.addRule(".name { color:" + hex(Theme.chatName()) + "; font-weight:bold; }");
|
||||
css.addRule(".event { color:" + hex(Theme.channelText()) + "; }");
|
||||
css.addRule(".event { color:" + hex(Theme.chatEvent()) + "; }");
|
||||
css.addRule("a { color:" + hex(Theme.chatName()) + "; text-decoration:none; }");
|
||||
// Client references look exactly like a message author's name.
|
||||
css.addRule("a." + BBCode.IDENTITY_LINK_CLASS
|
||||
@@ -83,6 +95,7 @@ final class HtmlStyles {
|
||||
kit.setStyleSheet(css);
|
||||
|
||||
pane.setEditorKit(kit);
|
||||
fillViewport(pane);
|
||||
if (html != null) {
|
||||
pane.setText(html);
|
||||
pane.setCaretPosition(atEnd ? pane.getDocument().getLength() : 0);
|
||||
|
||||
Reference in New Issue
Block a user