Skip to content

feat: add terminal dark mode toggle in Settings - #275

Merged
ravindu644 merged 4 commits into
ravindu644:devfrom
Yizhou147:feat-terminal-dark-mode
Aug 9, 2026
Merged

feat: add terminal dark mode toggle in Settings#275
ravindu644 merged 4 commits into
ravindu644:devfrom
Yizhou147:feat-terminal-dark-mode

Conversation

@Yizhou147

Copy link
Copy Markdown
Contributor

Summary

Adds a "Terminal Dark Mode" toggle in the Appearance section of Settings. When enabled, only the terminal page renders in dark colors (pure white text on a black background, classic termux scheme) while the rest of the app keeps the light theme. When disabled, the terminal follows the app theme as before.

Motivation

On light-themed setups the terminal area used theme-derived colors that could be hard to read, and there was no way to force a dark terminal independently of the app-wide theme. This lets users keep a light UI everywhere else while still getting a high-contrast dark terminal.

Changes Made

  • Constants.kt: added KEY_TERMINAL_DARK_THEME preference key
  • PreferencesManager.kt: added terminalDarkTheme property (default false)
  • SettingsScreen.kt: added a "Terminal Dark Mode" switch under Appearance
  • ContainerTerminalScreen.kt:
    • When the toggle is on, sets the terminal foreground/cursor to pure white (#FFFFFF) and background to pure black (#000000) via the termux TerminalColors indices (256/257/258)
    • Sets the TerminalView view background directly, since the termux renderer only paints cell backgrounds and the full-screen default background comes from the View itself
    • Applies the same dark colors to the virtual keys bar

Strings

Added terminal_dark_theme / terminal_dark_theme_description to the default (English) and Simplified Chinese string resources.

Testing

Verified on a Xiaomi tablet: enabling the toggle turns only the terminal page dark (white on black) while the rest of the app stays light; disabling it restores the previous behavior.

Add a 'Terminal Dark Mode' switch in the Appearance settings section that
renders only the terminal page in dark colors (dark background, light
foreground/cursor, dark virtual keys bar) while the rest of the app keeps
the light theme. The preference is independent of the app-wide theme.
The termux renderer only paints cell backgrounds; the full-screen default
background comes from the View itself. Set the TerminalView background to
dark when terminal dark mode is enabled, otherwise the terminal area stays
white while only the foreground/cursor colors change.
Change the terminal dark mode foreground/background to pure white (#FFFFFF)
on pure black (#000000), matching termux's default scheme instead of the
previous grayish text (#E2E2E6) on dark gray background (#121212).
Use Compose's Color.White / Color.Black constants instead of the
Android android.graphics.Color.WHITE/BLACK uppercase aliases.
@ravindu644
ravindu644 changed the base branch from main to dev August 9, 2026 15:21
@ravindu644
ravindu644 merged commit 83a77e6 into ravindu644:dev Aug 9, 2026
1 check passed
@ravindu644

Copy link
Copy Markdown
Owner

I guess this PR broke the terminal font color in some devices on light mode even though it works for me.

I'll investigate this once I got some free time, or you can do it too.

IMG_20260811_060841_511

@Yizhou147

Copy link
Copy Markdown
Contributor Author

Poor terminal-font readability under light mode is a pre-existing bug. For instance, it occurs occasionally while using nano. That is why I implemented this terminal dark-mode option. I will attempt to fix the font-color issue for light mode.

@Yizhou147

Copy link
Copy Markdown
Contributor Author

I tracked it down and pushed a fix to the branch.

Root cause: the PR always overrode the default background color and painted the TerminalView background, even in light mode. Now light mode keeps the previous behavior — the Activity background shows through and the default background stays as-is. Those overrides only run when "Terminal Dark Mode" is enabled.

@ravindu644

Copy link
Copy Markdown
Owner

I tracked it down and pushed a fix to the branch.

Root cause: the PR always overrode the default background color and painted the TerminalView background, even in light mode. Now light mode keeps the previous behavior — the Activity background shows through and the default background stays as-is. Those overrides only run when "Terminal Dark Mode" is enabled.

Thank you. It's fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants