fix: only apply background overrides in terminal dark mode - #276
Merged
Conversation
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.
Light mode now keeps the pre-PR behavior: the Activity background shows through the TerminalView and the default background color is left untouched. The full-screen background paint and the default-background override only apply when "Terminal Dark Mode" is enabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the light-mode terminal rendering regression reported after #275 was merged. In light mode the terminal font/background now renders exactly as it did before the dark-mode feature was introduced.
Root cause
#275 set the TerminalView background and the default background color (index 257) unconditionally, deriving them from the Material theme surface color. In light mode this changed the previous behavior, where the Activity background shows through the TerminalView and the terminal’s default background is left untouched — which caused broken font rendering on some devices.
Fix
The full-screen background paint (
setBackgroundColor) and the default background color override are now only applied when "Terminal Dark Mode" is enabled. Light mode keeps the exact pre-#275 behavior.Changes
ContainerTerminalScreen.kt: gate background overrides behind theterminalDarkThemepreference.