Skip to content

feat!: add partial night & day theme support #1818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2025

Conversation

erisu
Copy link
Member

@erisu erisu commented Jun 27, 2025

Motivation and Context

  • Add partial support for Night & Day Theming.
  • Prefix Cordova core resource values with cdv_* to avoid issues caused by plugins that either create or modify the same files.

This should also:

Resolves #1485

Cover SplashScreen & Background Color. (SystemBars, such as Status Bar & Gesture/Navigation Bar, will be handled in a separate PR)

Description

  • res/values/cdv_colors.xml
    • A rename from colors.xml.
    • cdv_background_color set to #FAF8FF. Same values as SDK 34+.
    • cdv_splashscreen_background set to @color/cdv_background_color to match background color.
  • res/values-v34/cdv_colors.xml
    • New file
    • cdv_background_color set to @android:color/system_background_light.
    • cdv_splashscreen_background set to @color/cdv_background_color to match background color.
  • res/values-night/cdv_colors.xml
    • New file
    • cdv_background_color set to #121318. Same values as SDK 34+.
    • cdv_splashscreen_background set to @color/cdv_background_color to match background color.
  • res/values-night-v34/cdv_colors.xml
    • New file
    • cdv_background_color set to @android:color/system_background_dark.
    • cdv_splashscreen_background set to @color/cdv_background_color to match background color.
  • res/values/cdv_themes.xml
    • A rename from themes.xml.
    • New postSplashScreenTheme default value @style/Theme.Cordova.App.DayNight.
    • Theme.Cordova.App.DayNight new theme with android:colorBackground set to @color/cdv_background_color
  • res/values/cdv_strings.xml
    • A rename from cdv_strings.xml.

SplashScreen background color can be set by the following preferences, in the order of priority:

  • AndroidWindowSplashScreenBackground
  • SplashScreenBackgroundColor
  • BackgroundColor

Previously when the preferences was set and cordova prepare was executed, colors.xml would have been updated.
Now, cdv_themes.xml would be updated instead with the #RRGGBB or #AARRGGBB value inserted into the SplashScreens windowSplashScreenBackground. Since Cordova only accepted one color value for the SplashScreen background, it was easier to change the theme instead of the four colors resource files.

Testing

  • npm t
  • Build App
  • Tried setting preferences to another color.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@erisu erisu force-pushed the feat/default-night-day-theming branch from 1928ec3 to 3ba2c22 Compare June 27, 2025 07:15
@erisu erisu marked this pull request as ready for review June 27, 2025 07:19
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.24%. Comparing base (484c60e) to head (3ba2c22).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
lib/prepare.js 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1818      +/-   ##
==========================================
+ Coverage   72.12%   72.24%   +0.11%     
==========================================
  Files          23       23              
  Lines        1844     1841       -3     
==========================================
  Hits         1330     1330              
+ Misses        514      511       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erisu erisu added this to the 15.0.0 milestone Jul 2, 2025
Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

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

LGTM

@erisu erisu merged commit 60d2842 into apache:master Jul 7, 2025
11 checks passed
@erisu erisu deleted the feat/default-night-day-theming branch July 7, 2025 13:31
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.

Splash screen background color is always black if dark mode is on
3 participants