The control-chrome restyle left showPanePicker on a stock AlertDialog (setTitle/setItems), so the pane selector rendered with the default Material theme instead of the neon chrome. Replace it with a themed showPaneDialog built from the existing primitives: an accent header, a roundedStroke window background, and PaneActive/PaneInactive chromeButton rows in a ScrollView. Extract selection side-effects into selectPane. Add docs/android-theming.md describing where the palette lives (Chrome object, terminalHtml CSS, styles.xml), the building-block helpers, the themed-dialog pattern, and a checklist for new controls.
5.3 KiB
Android Theming
The Android app has its own neon-on-near-black look that is not shared with
the browser app (public/app.css is a separate, dimmer palette). Everything
visual lives in one file:
android-app/app/src/main/java/dev/airc/tmuxremote/MainActivity.kt
There is no XML layout and no per-widget styles file — the UI is built in code
in buildUi(), and colors/shapes come from a small set of helpers. When adding
a new control, reuse those helpers instead of setting raw colors so the new
piece matches automatically.
Where the colors live
The palette is declared in three places that must stay in sync:
MainActivity.Chrome— theobjectnear the top of the file. Native Kotlin colors (ARGB ints) for every chrome surface, button, dot, and border. This is the source of truth for the native UI (top bar, buttons, dialogs, input row).terminalHtml()— the embedded WebView's CSS:rootblock. Mirrors the same hex values for the terminal render area (--bg,--surface,--primary,--accent,--muted,--amber,--danger, plus thefg-*/bg-*ANSI palette). Change a brand color here too or the terminal will drift from the chrome around it.res/values/styles.xml—AppThemesetsmonospace, the dark status/nav bar colors, andwindowLightStatusBar=false.applySystemBarColors()also re-applies the bar tints at runtime for older devices.
Palette (Chrome)
| Token | Hex | Use |
|---|---|---|
bg |
#070B0A |
App background, WebView, recessed button fills |
surface |
#0A100E |
Top/bottom bars, dialog & popup backgrounds |
primary |
#9EF56C |
Brand green: primary/active fills, live status |
primaryDim |
#6CC458 |
Inactive pane text, input hint |
accent |
#16FFFF |
Cyan: enter key, icon button, dialog OK, section labels |
accent2 |
#FF6EC7 |
Magenta (ANSI palette only so far) |
muted |
#D5D0AC |
Body/input text |
amber |
#EF9F27 |
Connecting / reconnecting status |
danger |
#E24B4A |
Offline status, ANSI red |
primaryText |
#04240F |
Dark text on a primary fill |
borderAlpha |
#4D9EF56C |
Default 30%-green stroke |
dimBorder |
#666CC458 |
Inactive stroke |
wash |
0x1F9EF56C |
Pressed-state translucent green fill |
offlineFill |
#140909 |
Hollow status dot center |
radiusDp |
6 |
Corner radius for every rounded shape |
Building blocks
Use these instead of hand-rolling drawables:
chromeButton(label, kind) { action }— the only button factory. Mono font, no all-caps, no elevation, press-scale animation, and aButtonKindthat picks colors. Returns aButtonyou can still tweak (gravity, padding).ButtonKind— the styling enum, resolved inapplyButtonKind():Primary— green fill, dark text (the send button).Enter— cyan outline on bg (the enter key).PaneActive— green fill, dark text (selected pane / top-bar pane button).PaneInactive— dim outline on bg (unselected pane rows).IconAccent— borderless cyan glyph (the ⚙ settings button).Key— green outline on bg (quick keys:A-,A+,^,v). Each kind also sets a matchingsetShadowLayerglow.
roundedStroke(fill, stroke, radiusDp)— a rounded rectangleGradientDrawable. Used for inputs, popup/dialog backgrounds, and as the base of button states. This is also how dialogs get their themed window background:window?.setBackgroundDrawable(roundedStroke(Chrome.surface, Chrome.borderAlpha, Chrome.radiusDp)).stateBackground(fill, stroke, pressedFill)— aStateListDrawablethat swaps fill on press.chromeButtonuses it under the hood.dotDrawable(color, filled, glow)— the status indicator dot (filled + halo when live, hollow when offline).dp(value)— density helper. All sizing is indp(...), never raw px.
Themed dialogs and popups
Stock AlertDialog/PopupWindow chrome (titles, list items, Material buttons)
does not match. The pattern used by showStatusDetail(),
showSettingsMenu(), and showPaneDialog() is:
- Build the content as a
LinearLayout(headerTextViewinaccent, thenchromeButtonrows or muted text). - For a dialog,
create()it with.setView(...)and no title/items, then insetOnShowListenerset the window background to aroundedStrokeand theme any default buttons (mono font +accenttext). - For a popup, set the panel background to
roundedStrokeand a transparentPopupWindowbackground.
showPairDialog() is the one remaining stock-styled dialog (plain title + two
EditTexts). It was intentionally left simple; restyle it the same way if its
look starts to matter.
Checklist for adding a new control
- Color comes from a
Chrome.*token — add a token if a genuinely new color is needed (and mirror it intoterminalHtml()if it's a brand color). - Buttons go through
chromeButtonwith an existingButtonKind; add a kind (and a branch inapplyButtonKind) only for a genuinely new role. - Shapes use
roundedStroke/stateBackgroundandChrome.radiusDp. - Sizes/margins/padding use
dp(...). - Text uses
monoTypeface,includeFontPadding = false. - New dialogs/popups follow the themed-dialog pattern above rather than stock
setTitle/setItems.