Skip to content

[Android][Regression] SwipeItem IconImageSource becomes black on black background in Dark Mode #36766

Closed

Description

@kamano1

Description

When using a SwipeItem with IconImageSource on Android, the icon becomes black on a black background in Dark Mode when running with Microsoft.Maui.Controls 10.0.90.
The issue can be reproduced using the sample from issue #36736 with an SVG image assigned to SwipeItem.IconImageSource.
In Microsoft.Maui.Controls 10.0.80 and earlier, the SwipeItem is displayed with a white background and a black icon, making the icon clearly visible.

In Microsoft.Maui.Controls 10.0.90, the SwipeItem background becomes black while the icon also remains black. As a result, the icon has little or no contrast against the background and becomes difficult to see.

The same SVG file, application code, Android emulator, and device settings were used for all tests. The only change was the Microsoft.Maui.Controls version.

The issue was reproduced on Android 14, Android 15, and Android 16 while the device was configured to use Dark Mode.
Attached screenshots compare the behavior of Microsoft.Maui.Controls 10.0.80 and 10.0.90.
Expected behavior:
The SwipeItem IconImageSource should remain clearly visible regardless of whether the device is using Light Mode or Dark Mode.

Actual behavior:
In Dark Mode with Microsoft.Maui.Controls 10.0.90, the icon is rendered as black on a black background, resulting in insufficient contrast and poor visibility.

Image

Steps to Reproduce

  1. Create a new .NET MAUI application.

  2. Replace MainPage.xaml and MainPage.xaml.cs with the sample provided in issue [Android][Regression] SwipeItem Text and IconImageSource are vertically misaligned when SwipeView wraps CollectionView #36736.

  3. Add the following SVG image to:
    Resources/Images/ic_fluent_arrow_circle_left_24_filled.svg
    https://all.undo.jp/ic_fluent_arrow_circle_left_24_filled.svg

  4. Update Microsoft.Maui.Controls to 10.0.90.

  5. Configure the Android emulator to use Dark Mode.

  6. Run the application.

  7. Swipe the CollectionView to reveal the SwipeItem.

  8. Observe the SwipeItem IconImageSource.

  9. Repeat the same test using Microsoft.Maui.Controls 10.0.80.

  10. Compare the results between 10.0.80 and 10.0.90.

Observed result:

  • 10.0.80: white background with visible black icon.
  • 10.0.90: black background with black icon.

The issue is reproducible consistently.

Link to public reproduction project repository

No response

Version with bug

10.0.90

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.80

Affected platforms

Android

Affected platform versions

Android 14/15/16

Did you find any workaround?

No.
The only known way to avoid the issue is to use Microsoft.Maui.Controls 10.0.80 or earlier.

Relevant log output

Activity

  1. added
    t/bug
    on Jul 24, 2026
  2. NafeelaNazhir commented on Jul 24, 2026

    @NafeelaNazhir
    Contributor

    This issue has been validated in Visual Studio Code 1.129.0 with .NET MAUI versions 10.0.80 and 10.0.90. It can be reproducible on Android platform from 10.0.90 version.

    Issue36766.zip

    10.0.90 10.0.80
    Image Image
  3. added
    s/verified
    s/triaged
    i/regression
    on Jul 24, 2026
  4. added this to the .NET 10 SR10 milestone on Jul 24, 2026
  5. added
    partner/syncfusion
    on Jul 24, 2026
  6. sheiksyedm commented on Jul 28, 2026

    @sheiksyedm
    Contributor

    @kamano1 As per my analyze, the reported issue is not a regression; it is a behavior change.

    Previously, the swipe item icon color was determined by the swipe item's background color rather than the color defined in the SVG icon. For example, if the swipe item background was white, the icon would appear black. If the background was black, the icon would appear white, even when the SVG icon's fill color was explicitly set to Red.

    This issue was addressed in PR #35632. With this change, the swipe item icon color is now rendered based on the color defined in the SVG file. This behavior is consistent with other platforms and with Xamarin.

    In your case, the icon color defined in the SVG file is #212121. As a result, that color is applied in both Light and Dark modes.

    Image

    @PureWeen @kubaflo : Could you please confirm whether including this behavior change in a service release is appropriate?

    Many users expect the icon color specified in the SVG file to be respected rather than having it automatically adjusted based on the background color. So that, this changes included on SR9. However, if this change affects existing users, we can revert PR #35632 in the service release and move the behavior change to .NET 11 release. Along with that, we could introduce explicit swipe icon color support, allowing users to apply icon colors based on theme changes instead of relying on the original SVG icon color.

  7. kubaflo commented on Jul 28, 2026

    @kubaflo
    Contributor

    Thanks for digging into this @sheiksyedm — but I don't think this should stay in servicing. A couple of corrections first, then my recommendation.

    "Consistent with Xamarin" isn't accurate

    Xamarin.Forms applied the auto-contrast tint unconditionally to every icon, on both platforms:

    • Android SwipeViewRenderer.cs#L858 — drawable.SetColorFilter(textColor.ToAndroid(), FilterMode.SrcAtop);, where textColor = GetSwipeItemColor(formsSwipeItem.BackgroundColor) — a luminosity-based white/black pick (L906–910)
    • iOS SwipeViewRenderer.cs#L713-715 — AlwaysTemplate + TintColor = GetSwipeItemColor(swipeItem.BackgroundColor)

    So the pre-#35632 MAUI behavior was the Xamarin behavior. #35632 is a departure from Xamarin, not alignment with it.

    "Consistent with other platforms" doesn't hold either

    Before #35632, every platform auto-contrast-tinted the icon:

    • Android — SetColorFilter(GetTextColor(), SrcAtop) on every drawable
    • iOS/Mac — AlwaysTemplate on every image + TintColor = fontImageSource.Color ?? GetTextColor()
    • Windows — ToIconSource() produced a BitmapIconSource, whose ShowAsMonochrome defaults to true, so the bitmap rendered as a mask in Foreground — which UpdateTextColor set to TextColor ?? GetTextColor()

    That's precisely why #35632 had to change all three handlers, and why the Windows fix was swapping BitmapIconSource → ImageIconSource (the only way out of ShowAsMonochrome). MAUI was uniform before and is uniform after — consistency isn't the differentiator here. The differentiator is that the old uniform behavior matched Xamarin and guaranteed legibility, and the new one doesn't.

    The auto-contrast was deliberate, and we only half-removed it

    GetTextColor() in src/Core/src/Platform/SwipeViewExtensions.cs picks white or black from background luminosity. It's a legibility guarantee, not legacy accident. #35632 removed it for PNG/SVG but left it in place for the label text — so the item's text is still contrast-corrected while its icon isn't. The end state is internally inconsistent.

    It compounds with #36271

    #36271 (also SR9) makes BackgroundColor correctly follow AppThemeBinding, so the item legitimately goes dark in dark mode. Before SR9 the stale light background accidentally preserved contrast. Individually each change is defensible; together they produce genuinely invisible black-on-black, which is what @kamano1 is seeing. #36573 is a third open regression in this same code path, also milestoned SR10.

    The part that decides it for me

    #23074 is labelled proposal/open — a feature request, and its title literally asks for more configuration. What shipped is a behavior change with no configuration: there's no IconColor or tint opt-out, so an affected app's only options are pinning to 10.0.80 or re-authoring every SVG per theme. That's not an acceptable servicing outcome regardless of which behavior is "more correct", and it's why the i/regression + regressed-in-10.0.90 labels here are right.

    Recommendation

    Revert #35632 from inflight/current for SR10, and keep/land it on net11.0 paired with the explicit swipe-icon color/tint API you proposed. That puts the more-correct behavior where a breaking change is allowed and gives users a real opt-in, instead of a silent rendering change in a patch release.

    #36573 should stay on SR10 — that one is a genuine bug in the theme-refresh path and is worth fixing independently.

  8. kubaflo commented on Jul 28, 2026

    @kubaflo
    Contributor

    Fixed for SR10. Summary of where this landed and why.

    What was wrong

    This was a real regression, not just a behavior change. Two SR9 changes combined:

    1. Fix SwipeItem IconImageSource color handling and rendering across platforms #35632 removed the automatic icon tinting for PNG/SVG swipe item icons, so they now render in their authored colors instead of a contrast color derived from the item background.
    2. Fix SwipeItem background not updating on AppTheme change #36271 made SwipeItem.BackgroundColor correctly follow AppThemeBinding.

    Before SR9, the stale light background accidentally preserved contrast. Together, the two produce black-on-black: an SVG whose fill is #212121 on a dark background is effectively invisible.

    Worth correcting one point from the earlier analysis — the previous tinting was not an Android-only inconsistency, and it was not divergent from Xamarin. Xamarin.Forms tinted every swipe icon unconditionally on both Android and iOS, and MAUI tinted on all three platforms (Windows via BitmapIconSource, whose ShowAsMonochrome defaults to true) — which is why #35632 had to touch all three handlers.

    What we did

    Servicing (SR10) — reverted. #36887 is merged into inflight/candidate. The pre-SR9 tinting behavior is restored on Android, iOS/Mac and Windows, so IconImageSource icons are legible against their background again in both themes.

    The direction of #35632 is right, but it shipped as a silent rendering change in a patch release with no opt-out. Affected apps had no option other than pinning to 10.0.80 or re-authoring every SVG per theme. It also removed a legibility guarantee only for icons while leaving the item's label text contrast-corrected, which is inconsistent on its own. And #23074, the issue #35632 addressed, was labelled proposal/open — a request for more configuration, not a bug report.

    .NET 11 — kept, with a real opt-in. #36884 reinstates the #35632 behavior and adds an explicit SwipeItem.IconColor property:

    • IconColor unset → previous auto-contrast tinting (unchanged from today's servicing behavior)
    • IconColor set → that color is used as the tint
    • IconColor="Transparent" → no tint; the icon renders in its authored colors

    IconColor is a regular bindable property, so it works with AppThemeBinding for per-theme icon colors.

    For anyone hitting this now

    Until SR10 ships, setting an explicit non-theme-following BackgroundColor on the affected SwipeItem restores contrast. On .NET 11 you'll be able to use IconColor="Transparent" to opt into authored SVG colors deliberately.

    Thanks @kamano1 for the clear report and repro.

  9. locked and limited conversation to collaborators on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-swipeviewi/regressionpartner/syncfusionplatform/androidregressed-in-10.0.90s/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions