From 0890cda100295cbfef7a3f0ad43d0e3c784965cf Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 18 Jun 2026 19:55:33 -0500 Subject: feat(theme-studio): add mode-line-highlight as an editable face The mode-line hover box (the raised bevel on clickable mode-line segments) came from mode-line-highlight, a face the studio never managed, so it fell through to Emacs's stock released-button default with no way to change it. I added it to the generated UI face list, between mode-line and mode-line-inactive. The row and box control are already generic over that list, so they appear automatically. build-theme.el's UI emission is generic too, so the elisp side needs nothing. The face isn't in the captured Emacs snapshot, so apply_hover_box_default seeds its box to the raised default in both build_uimap branches. That matches current behavior and leaves the user free to flatten or recolor it. The mock frame previews the hover by wrapping a mode-line segment in the face. --- scripts/theme-studio/generate.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'scripts/theme-studio/generate.py') diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py index c489b79cc..ae31afae2 100644 --- a/scripts/theme-studio/generate.py +++ b/scripts/theme-studio/generate.py @@ -108,11 +108,26 @@ def apply_builtin_fallback_styles(uimap): for face in ("mode-line","mode-line-inactive"): uimap[face]["box"]={"style":"released","width":1,"color":None} +def apply_hover_box_default(uimap): + """Seed the mode-line hover face's box. + + `mode-line-highlight` (applied via mouse-face to the clickable mode-line + segments) is absent from the captured Emacs snapshot, so seed() returns + blank for it in both branches below. Emacs's stock default is a raised + released-button box; default to that so the studio reflects current + behavior, then let the user flatten or recolor it. A future snapshot that + captures the face wins (the box-already-set guard leaves it alone).""" + face=uimap.get("mode-line-highlight") + if face and not face.get("box"): + face["box"]={"style":"released","width":1,"color":None} + def build_uimap(ui_faces,defaults): if defaults.available: - return {face[0]:ui_face_spec(defaults.seed(face[0],False)) for face in ui_faces} - uimap={face[0]:ui_face_spec() for face in ui_faces} - apply_builtin_fallback_styles(uimap) + uimap={face[0]:ui_face_spec(defaults.seed(face[0],False)) for face in ui_faces} + else: + uimap={face[0]:ui_face_spec() for face in ui_faces} + apply_builtin_fallback_styles(uimap) + apply_hover_box_default(uimap) return uimap def build_syntax(cols,map_,bold,italic,defaults): @@ -197,7 +212,9 @@ CATS=[["bg","bg (ground)","Aa Bb 123"],["p","fg","other / whitespace"],["kw","ke ["punc","punctuation","{ } ( ) ;"]] UI_FACES=[["cursor","cursor","Aa|"],["region","region (selection)","selected text"], ["hl-line","hl-line (current line)","current line"],["highlight","highlight","hover"], - ["mode-line","mode-line","status active"],["mode-line-inactive","mode-line-inactive","status idle"], + ["mode-line","mode-line","status active"], + ["mode-line-highlight","mode-line-highlight (mode-line hover)","git:main"], + ["mode-line-inactive","mode-line-inactive","status idle"], ["fringe","fringe","| |"],["line-number","line-number"," 42"], ["line-number-current-line","line-number-current-line","> 42"],["minibuffer-prompt","minibuffer-prompt","M-x "], ["isearch","isearch (match)","match"],["lazy-highlight","lazy-highlight","other match"], -- cgit v1.2.3