Skip to content

fix: dark status bar icons on light theme#24

Merged
wassupluke merged 1 commit intomainfrom
feature/alarm-widget-font-size
Apr 3, 2026
Merged

fix: dark status bar icons on light theme#24
wassupluke merged 1 commit intomainfrom
feature/alarm-widget-font-size

Conversation

@wassupluke
Copy link
Copy Markdown
Owner

@wassupluke wassupluke commented Apr 3, 2026

Summary

  • enableEdgeToEdge() with no args uses SystemBarStyle.auto() which follows the system dark mode setting, causing white status bar icons on the app's light background when the device is in dark mode
  • Changed to SystemBarStyle.light(TRANSPARENT, TRANSPARENT) to always use dark icons
  • Removed redundant SideEffect in SimpleWeatherTheme that was trying (and failing) to do the same thing

Fixes #14

Test plan

  • Enable device dark mode, open the app — status bar icons should be dark/visible
  • Disable device dark mode, open the app — status bar icons should remain dark
  • Verify on API 31+ (dynamic color) and pre-31 devices

Summary by Sourcery

Ensure the app always uses dark status bar icons on its light theme regardless of system dark mode settings.

Bug Fixes:

  • Force light status bar style via enableEdgeToEdge to avoid white icons on a light background when the device is in dark mode.

Enhancements:

  • Simplify theming by removing redundant status bar appearance handling from SimpleWeatherTheme.

…t theme

enableEdgeToEdge() with no args uses SystemBarStyle.auto() which follows
the system dark mode, not the app theme — causing white icons on the
app's light background when the device is in dark mode.

Fixes #14
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Ensures the app always uses dark status bar icons on a light background by configuring edge-to-edge system bar styling in MainActivity and removing a redundant, now-unnecessary SideEffect-based status bar configuration from the app theme.

Sequence diagram for app launch and updated system bar styling

sequenceDiagram
    actor User
    participant AndroidSystem
    participant MainActivity
    participant SystemBars
    participant ComposeContent

    User->>AndroidSystem: Tap app icon
    AndroidSystem->>MainActivity: create Activity
    MainActivity->>MainActivity: onCreate(savedInstanceState)
    MainActivity->>MainActivity: enableEdgeToEdge(statusBarStyle = SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT))
    MainActivity->>SystemBars: Apply light status bar style
    SystemBars-->>MainActivity: Status bar icons set to dark
    MainActivity->>ComposeContent: setContent { SimpleWeatherTheme { ... } }
    ComposeContent-->>User: Render UI with light theme and dark status bar icons
Loading

Class diagram for MainActivity and SimpleWeatherTheme changes

classDiagram
    class ComponentActivity

    class MainActivity {
        +onCreate(savedInstanceState: Bundle): void
        +enableEdgeToEdge(statusBarStyle: SystemBarStyle): void
        +viewModelFactory: ViewModelProvider.Factory
    }

    class SimpleWeatherTheme {
        +SimpleWeatherTheme(content: ComposableFunction): void
    }

    class SystemBarStyle {
        +light(statusBarColor: Int, navigationBarColor: Int): SystemBarStyle
    }

    class Color {
        <<utility>>
        +TRANSPARENT: Int
    }

    class ComposableFunction {
        <<functional>>
    }

    MainActivity --|> ComponentActivity
    MainActivity ..> SystemBarStyle : uses
    MainActivity ..> Color : uses
    MainActivity ..> SimpleWeatherTheme : sets content with
    SimpleWeatherTheme ..> ComposableFunction : wraps content
Loading

File-Level Changes

Change Details Files
Configure edge-to-edge status bar style to always use dark icons regardless of system dark mode.
  • Replace default enableEdgeToEdge() call with a configuration that passes SystemBarStyle.light using transparent colors for both status and navigation bars.
  • Import SystemBarStyle and Color to support the new edge-to-edge configuration.
app/src/main/java/com/wassupluke/widgets/ui/MainActivity.kt
Remove redundant status bar icon configuration from the Compose theme.
  • Delete the SideEffect that manually obtains the Activity window and sets isAppearanceLightStatusBars to true.
  • Remove unused imports related to status bar manipulation, including Activity, SideEffect, LocalView, WindowCompat, and toArgb.
app/src/main/java/com/wassupluke/widgets/ui/theme/SimpleWeatherTheme.kt

Assessment against linked issues

Issue Objective Addressed Explanation
#14 Ensure the status bar text/icons are dark (and thus visible) when the app uses a light background, fixing the white-on-light visibility bug.
#14 Implement logic so the status bar text color dynamically adapts based on the app background / system theme (e.g., switching between light and dark icons as the app theme changes). The PR hardcodes a light SystemBarStyle with dark icons via enableEdgeToEdge(statusBarStyle = SystemBarStyle.light(...)), ensuring dark icons regardless of system dark mode. It does not include any dynamic behavior to switch status bar icon color when the app background or theme changes.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Using SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT) hardcodes dark icons regardless of the actual content behind the status bar; consider basing icon appearance on the top surface/theme luminance so contrast remains acceptable on all screens.
  • You currently only override statusBarStyle in enableEdgeToEdge; if the app uses a consistently light navigation bar as well, consider also setting navigationBarStyle for visual consistency.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT)` hardcodes dark icons regardless of the actual content behind the status bar; consider basing icon appearance on the top surface/theme luminance so contrast remains acceptable on all screens.
- You currently only override `statusBarStyle` in `enableEdgeToEdge`; if the app uses a consistently light navigation bar as well, consider also setting `navigationBarStyle` for visual consistency.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@wassupluke wassupluke merged commit 00adb4b into main Apr 3, 2026
3 checks passed
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.

[bug] status bar text is white on light

1 participant