Skip to content

feat: add dark mode support - #222

Open
phillip9933 wants to merge 20 commits into
opencloud-eu:mainfrom
phillip9933:feature/dark-mode
Open

feat: add dark mode support#222
phillip9933 wants to merge 20 commits into
opencloud-eu:mainfrom
phillip9933:feature/dark-mode

Conversation

@phillip9933

@phillip9933 phillip9933 commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Adds dark mode support by replacing hardcoded white backgrounds with theme-aware DayNight attributes across the app.
Closes #23

Changes

  • Updated the base app theme (styles.xml) to use platform semantic background attributes linked to theme_color_background.
  • Updated FileListAdapter and item_file_list.xml to use ?attr/colorSurface instead of hardcoded white backgrounds.
  • Migrated secondary layouts (pattern lock, passcode, empty states, navigation containers) to use
    ?android:attr/colorBackground.
  • Fixed the top progress bar drawable to respect the theme surface color.

Testing

  • Built and verified locally using ./gradlew :opencloudApp:assembleOriginalDebug.
  • Tested light and dark mode toggling in the app settings on an emulator.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new Appearance preference handling has a correctness issue for missing/invalid persisted values, and there are dark-mode theming gaps (e.g., selection and dialogs) that should be addressed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces app-wide dark mode support by switching to a DayNight base theme and migrating many UI surfaces/text to theme-resolved semantic colors, plus adds a user-facing appearance mode setting.

Changes:

  • Switch Theme.openCloud to Theme.AppCompat.DayNight.* and introduce semantic color tokens with values-night overrides.
  • Replace hardcoded light colors in many layouts/drawables with ?attr/* / ?android:attr/* theme attributes.
  • Add an “Appearance” setting backed by an AppearanceMode enum and apply it at app startup via AppCompatDelegate.
File summaries
File Description
opencloudApp/src/test/java/eu/opencloud/android/presentation/settings/AppearanceModeTest.kt Adds unit tests for preference-to-night-mode mapping.
opencloudApp/src/main/res/xml/settings.xml Adds the Appearance ListPreference to settings screen.
opencloudApp/src/main/res/values/styles.xml Switches base theme to DayNight; adds semantic theme color items.
opencloudApp/src/main/res/values/strings.xml Adds Appearance preference strings.
opencloudApp/src/main/res/values/colors.xml Adds DayNight semantic color tokens (light defaults).
opencloudApp/src/main/res/values-night/colors.xml Adds DayNight semantic color tokens (dark overrides).
opencloudApp/src/main/res/layout/whats_new_element.xml Updates text colors to theme-aware colorOnPrimary.
opencloudApp/src/main/res/layout/whats_new_activity.xml Updates skip button text color to theme-aware colorOnPrimary.
opencloudApp/src/main/res/layout/uploader_list_item_layout.xml Migrates uploader list text colors to colorOnSurface*.
opencloudApp/src/main/res/layout/uploader_layout.xml Migrates list divider color to theme colorOutline.
opencloudApp/src/main/res/layout/upload_list_item.xml Migrates upload list text colors to colorOnSurface*.
opencloudApp/src/main/res/layout/upload_bottom_sheet_fragment.xml Migrates bottom sheet background/divider/title colors to theme.
opencloudApp/src/main/res/layout/ssl_validator_layout.xml Migrates SSL validator text color to colorOnSurface.
opencloudApp/src/main/res/layout/ssl_untrusted_cert_layout.xml Migrates SSL untrusted cert header color to colorOnSurface.
opencloudApp/src/main/res/layout/spaces_list_item.xml Migrates card background and text colors to surface/on-surface.
opencloudApp/src/main/res/layout/space_path_line.xml Migrates icon/text tint to colorOnSurfaceVariant.
opencloudApp/src/main/res/layout/space_header.xml Migrates header backgrounds and text colors to surface/on-surface.
opencloudApp/src/main/res/layout/sort_options_layout.xml Migrates bottom sheet header text/icon tint to colorOnPrimary.
opencloudApp/src/main/res/layout/sort_bottom_sheet_fragment.xml Migrates bottom sheet background/divider/title colors to theme.
opencloudApp/src/main/res/layout/share_user_item.xml Migrates share user item text color to colorOnSurface.
opencloudApp/src/main/res/layout/share_public_link_item.xml Migrates public link item title color to colorOnSurface.
opencloudApp/src/main/res/layout/share_public_dialog.xml Migrates dialog label/secondary text colors to theme-aware attrs.
opencloudApp/src/main/res/layout/share_file_layout.xml Migrates share file sheet colors to on-surface/on-primary.
opencloudApp/src/main/res/layout/remove_files_dialog.xml Migrates dialog card/text colors to surface/on-surface.
opencloudApp/src/main/res/layout/rate_me_dialog.xml Migrates button text to colorOnPrimary.
opencloudApp/src/main/res/layout/passcodelock.xml Migrates passcode lock backgrounds/text to theme attributes.
opencloudApp/src/main/res/layout/opencloud_toolbar.xml Migrates toolbar text/drawable tint to colorOnPrimary.
opencloudApp/src/main/res/layout/newfile_bottom_sheet_fragment.xml Migrates bottom sheet background/divider/title colors to theme.
opencloudApp/src/main/res/layout/nav_main_container.xml Migrates main container background to platform background attr.
opencloudApp/src/main/res/layout/nav_drawer_header.xml Migrates drawer header text color to colorOnPrimary.
opencloudApp/src/main/res/layout/nav_drawer_footer.xml Migrates drawer footer text colors to on-surface variants.
opencloudApp/src/main/res/layout/nav_drawer_content.xml Sets drawer backgrounds to theme colorSurface.
opencloudApp/src/main/res/layout/nav_coordinator_layout.xml Migrates bottom nav icon/text tint to colorOnPrimary.
opencloudApp/src/main/res/layout/manage_accounts_dialog.xml Migrates dialog card/text/icon tint to theme attributes.
opencloudApp/src/main/res/layout/main_file_list_fragment.xml Migrates FAB label/icon colors to colorOnPrimary.
opencloudApp/src/main/res/layout/log_list_item.xml Migrates log list text colors to on-surface variants.
opencloudApp/src/main/res/layout/list_footer.xml Migrates footer text color to colorOnSurfaceVariant.
opencloudApp/src/main/res/layout/item_file_list.xml Adds surface background + migrates text/tints to on-surface variants.
opencloudApp/src/main/res/layout/item_empty_dataset.xml Migrates empty state tint/text colors to theme attributes.
opencloudApp/src/main/res/layout/grid_item.xml Migrates grid item text color to colorOnSurface.
opencloudApp/src/main/res/layout/fragment_migration_progress.xml Migrates wizard background/text/progress tint to primary/on-primary.
opencloudApp/src/main/res/layout/fragment_migration_intro.xml Migrates wizard background/text/button tint to primary/on-primary.
opencloudApp/src/main/res/layout/fragment_migration_completed.xml Migrates wizard background/text/button tint to primary/on-primary.
opencloudApp/src/main/res/layout/fragment_migration_choice.xml Migrates wizard background/text/button tint to primary/on-primary.
opencloudApp/src/main/res/layout/file_options_bottom_sheet_fragment.xml Migrates bottom sheet background/text/divider to theme attrs.
opencloudApp/src/main/res/layout/file_details_fragment.xml Migrates card/background/dividers to surface/outline theme attrs.
opencloudApp/src/main/res/layout/file_details_empty.xml Migrates empty background to platform background attr.
opencloudApp/src/main/res/layout/edit_share_layout.xml Migrates secondary text color to colorOnSurfaceVariant.
opencloudApp/src/main/res/layout/dialog_file_already_exists.xml Migrates dialog card/text colors to surface/on-surface.
opencloudApp/src/main/res/layout/create_shortcut_dialog.xml Migrates labels/disabled button text to on-surface variants.
opencloudApp/src/main/res/layout/activity_pattern_lock.xml Migrates background/text colors to theme attributes.
opencloudApp/src/main/res/layout/account_item.xml Migrates account item text/icon tints to on-surface variants.
opencloudApp/src/main/res/layout/account_action.xml Migrates account action icon/text to on-surface colors.
opencloudApp/src/main/res/drawable/top_progress_bar_determinate.xml Makes progress bar background use theme colorSurface.
opencloudApp/src/main/java/eu/opencloud/android/presentation/settings/SettingsFragment.kt Wires up Appearance preference and applies night mode on change.
opencloudApp/src/main/java/eu/opencloud/android/presentation/settings/AppearanceMode.kt Introduces AppearanceMode enum + preference mapping helper.
opencloudApp/src/main/java/eu/opencloud/android/presentation/files/filelist/FileListAdapter.kt Replaces hardcoded white with theme colorSurface for file list items.
opencloudApp/src/main/java/eu/opencloud/android/MainApp.kt Applies persisted appearance mode at application startup.
opencloudApp/src/androidTest/java/eu/opencloud/android/settings/SettingsFragmentTest.kt Extends UI test to validate Appearance preference configuration.
Review details
  • Files reviewed: 59/59 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread opencloudApp/src/main/res/values-night/colors.xml
Comment thread opencloudApp/src/main/res/values/styles.xml
@phillip9933

Copy link
Copy Markdown
Author

thanks for the sanity check with co-pilot. I've updated the issues it called out, should be ready for re-review

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dark mode / theme

3 participants