Skip to content

Conversation

@ujas-m-simformsolutions
Copy link
Collaborator

Description

Adds support for different splash background colors for light mode and dark mode on Android. When a dark color is provided via the existing color_dark_android config option, the tool generates color resources in both values/ and values-night/ folders so Android automatically applies the correct theme.

Changes:

  • Create values-night/ directory automatically when dark color is provided
  • Update Android 12+ styles to reference @color/splashBgColor instead of static color values for proper dark mode support
  • Add values-night-v31/ directory support for Android 12+ dark mode styles (only when color_dark_android is provided), ensuring windowSplashScreenAnimatedIcon works properly in dark mode

Usage:

splash_master:
  color: '#FFFFFF'
  color_dark_android: '#000000'

Generated output:

<!-- android/app/src/main/res/values/colors.xml -->
<color name="splashBgColor">#FFFFFF</color>

<!-- android/app/src/main/res/values-night/colors.xml -->
<color name="splashBgColor">#000000</color>

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #20

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Add Dark Mode Background Color Support for Android</issue_title>
<issue_description>## Summary

Add support for different splash background colors for light mode and dark mode on Android.
This includes generating color resources in both values/ and values-night/ folders so Android automatically applies the correct theme.

Expected Android Implementation

New Config Options
Allow users to specify:

  • dark_background_color

Output Structure (auto-generated)
Light mode

android/app/src/main/res/values/colors.xml

<resources>
    <color name="splash_background">#FFFFFF</color>
</resources>

Dark mode

android/app/src/main/res/values-night/colors.xml

<resources>
    <color name="splash_background">#000000</color>
</resources>

Splash theme should reference this color

<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
    <item name="android:windowBackground">@color/splash_background</item>
</style>

Android will automatically switch between values/ and values-night/ based on system theme.

Acceptance Criteria

  • Add support for generating values-night/colors.xml when a dark color is provided.
  • Ensure backward compatibility if only light mode color is specified.
  • Update splash theme to reference the generated color.</issue_description>

Comments on the Issue (you are @copilot in this section)

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.

Feature Request: Add Dark Mode Background Color Support for Android

2 participants