Skip to content

Align feedback thumb icon colors with iOS after interaction - #211

Merged
josej-ea merged 6 commits into
adobe:devfrom
josej-ea:feature/feedback-icon-colors
Nov 14, 2026
Merged

josej-ea merged 6 commits into
adobe:devfrom
josej-ea:feature/feedback-icon-colors

Conversation

@josej-ea

@josej-ea josej-ea commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The selected feedback thumb now uses the primary brand color and the unselected thumb dims, matching iOS behavior. Previously Android kept a single icon color for all states.

Changes

  • Added selectedIconColor (primary brand color) and dimmedIconColor (SwiftUI system gray #8E8E93 at 40% opacity) to FeedbackButtonsStyle.
  • Resolve each thumb tint by vote state in FeedbackComponents.kt:
    • No vote yet: concierge message text color.
    • Selected thumb: primary brand color.
    • Thumb not chosen: fixed system gray, independent of theme text color/alpha.
  • Added tint-selection unit tests and rendered-color coverage across states, placements, and default/custom themes.
  • Documented the behavior in the Android style guide.

Behavior parity

State iOS Android before Android after
Unselected Text color Text color Text color
Selected Primary Text color Primary
Not chosen SwiftUI system gray #8E8E93 at 40% Text color SwiftUI system gray #8E8E93 at 40%

Testing

  • FeedbackIconTintTest: 3 unit tests passed.
  • FeedbackComponentsTest, FeedbackIconColorsTest, and ConciergeStylesTest: 66 instrumented tests passed on the Android 17 emulator.
  • Kotlin formatting and diff checks passed.
  • The emulator required a temporary external AndroidX test-tooling override; no repository dependencies were changed.

The selected feedback thumb now tints with the primary brand color and the
unselected thumb dims, matching iOS behavior. Previously Android kept a single
icon color for all states, so the selected thumb stayed the message text color
while iOS changed to the primary color.

- Add selectedIconColor (primary) and dimmedIconColor (text at 40% alpha) to
  FeedbackButtonsStyle
- Resolve per-state tint in FeedbackComponents ThumbsRow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@josej-ea
josej-ea requested a review from rymorale November 10, 2026 18:48
spacing = 4.dp,
iconColor = textColor,
selectedIconColor = themeColors.primary,
dimmedIconColor = textColor.copy(alpha = 0.4f),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't quite match iOS. Both MessageFeedbackView.swift and SourcesListView.swift use Color.gray.opacity(0.4) for the thumb that wasn't chosen, no matter the theme. Here the dimmed thumb keeps the message text color, so it comes out black at 40% in light theme, near-white in dark theme, or a custom color, which differs from iOS. Should we align on gray, or update the parity table in the description if theme-aware dimming is intended?

Also, copy(alpha = 0.4f) replaces the existing alpha. If a theme sets a text color more transparent than 40%, the "dimmed" thumb ends up more visible than an unselected one. textColor.copy(alpha = textColor.alpha * 0.4f) avoids that if we keep this approach.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for switching to a fixed gray, that fixes the theme and alpha issues. The value is still off though: (0.5, 0.5, 0.5) is UIKit UIColor.gray, while SwiftUI Color.gray is system gray (142, 142, 147). Left details on the new line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed with Color(0x668E8E93), thanks!

val iconSize: Dp,
val spacing: Dp,
val iconColor: Color,
/** Tint for the thumb that was selected after feedback is submitted. Defaults to the primary brand color, matching iOS. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: "Defaults to the primary brand color" reads like a parameter default, but selectedIconColor is required. Maybe something like "Set to the primary brand color in feedbackButtonsStyle".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks!

// Resolve the tint for each thumb from the feedback state, matching iOS:
// no vote yet -> default text color; selected thumb -> primary brand color;
// the thumb not chosen -> dimmed.
val thumbUpTint = when (feedbackState) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we add test coverage for the new tints? The existing positive/negative tests in FeedbackComponentsTest only check that the icons are displayed, so they'd still pass if this change were reverted. Pulling the tint selection into a small pure function (state + which thumb -> color) would make it easy to unit test all three states without an emulator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, iconTintFor plus FeedbackIconTintTest covers this nicely. Left one non-blocking note on the pixel check in FeedbackIconColorsTest.

Use fixed neutral gray at 40% opacity for the unchosen thumb.
Extract shared tint selection and clarify selected-color documentation.

Add state-selection unit tests and rendered-color coverage across
feedback states, placements, and default/custom/translucent themes.
Document feedback tint behavior in the style guide.
@josej-ea
josej-ea requested a review from rymorale November 11, 2026 04:01
iconColor = textColor,
selectedIconColor = themeColors.primary,
// Match SwiftUI Color.gray.opacity(0.4); Compose Color.Gray uses a lighter RGB value.
dimmedIconColor = Color(red = 0.5f, green = 0.5f, blue = 0.5f, alpha = 0.4f),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(0.5, 0.5, 0.5) is UIKit's UIColor.gray, but SwiftUI Color.gray is a different color. It resolves to system gray, (142, 142, 147) / #8E8E93. I checked Color.gray.resolve(in:) and UIColor(Color.gray) on the iOS simulator, and it's the same in light and dark. So the comment above is reversed: Compose Color.Gray (#888888) is actually closer to iOS than this value.

Suggest:

// Match SwiftUI Color.gray.opacity(0.4) (system gray #8E8E93 at 40%).
dimmedIconColor = Color(0x668E8E93),

The expected values in FeedbackIconColorsTest (lines 112 and 150) and the RGB in the style guide would need to change to match.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, #8E8E93 at 40% matches SwiftUI Color.gray.opacity(0.4). Thanks!

Comment thread Documentation/style-guide.md Outdated
| `behavior.feedback.showCancelButton` | boolean \| null | `null` | Cancel button visibility. `null` = shown for `"modal"`, hidden for `"action"`. Both set to `false` is honored: Submit and (in action mode) drag-down still dismiss. |
| `behavior.feedback.alwaysDisplay` | boolean | `false` | When `true`, shows the feedback thumbs as soon as the response finishes streaming, bypassing the server's `feedbackEligible` flag. Does not bypass the streaming-complete requirement. |

Before a vote, both thumbs use the concierge message text color. After a vote, the selected thumb uses the primary brand color and the other thumb uses fixed neutral gray (RGB 128, 128, 128) at 40% opacity, matching iOS. The gray tint is independent of the theme's text color and opacity. This applies to both inline and below-message placement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since SwiftUI Color.gray is (142, 142, 147), "RGB 128, 128, 128 … matching iOS" isn't accurate. This should be updated along with the color fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated, thanks!

}
assertTrue(
"${case.name}, below=$showLabel, $vote, $description: expected $expected",
matchingPixels >= 5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: passing when any 5 pixels roughly match is a fairly loose check. Anti-aliased edges of a wrong (darker) tint can produce pixels that match a lighter expected color, and the count depends on screen density. It might be sturdier to require a minimum fraction of the icon's opaque pixels to match, or to sample known interior pixels of the filled icon. Also note that in the default light theme, text and primary are both black, so that case can't tell the selected thumb from the unvoted one (the dark and custom cases cover it).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, the relative sampling is a nice improvement. Left a couple of follow-up notes on the new version.

spacing = 4.dp,
iconColor = textColor,
selectedIconColor = themeColors.primary,
dimmedIconColor = textColor.copy(alpha = 0.4f),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for switching to a fixed gray, that fixes the theme and alpha issues. The value is still off though: (0.5, 0.5, 0.5) is UIKit UIColor.gray, while SwiftUI Color.gray is system gray (142, 142, 147). Left details on the new line.

val iconSize: Dp,
val spacing: Dp,
val iconColor: Color,
/** Tint for the thumb that was selected after feedback is submitted. Defaults to the primary brand color, matching iOS. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks!

// Resolve the tint for each thumb from the feedback state, matching iOS:
// no vote yet -> default text color; selected thumb -> primary brand color;
// the thumb not chosen -> dimmed.
val thumbUpTint = when (feedbackState) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, iconTintFor plus FeedbackIconTintTest covers this nicely. Left one non-blocking note on the pixel check in FeedbackIconColorsTest.

Use #8E8E93 at 40% opacity for the unselected thumb. Update the
style guide and tighten rendered-color assertions to check a fraction
of foreground icon pixels.
Compare sampled opaque foreground colors instead of requiring a
large fraction of exact-color pixels, which varies with anti-aliasing
and emulator density. Retain exact tint assertions in the style test.
@josej-ea
josej-ea requested a review from rymorale November 12, 2026 05:14
@josej-ea

Copy link
Copy Markdown
Collaborator Author

@BNanda99

@josej-ea
josej-ea requested a review from BNanda99 November 13, 2026 14:52

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved the pr with just a couple of nit / non blocking issues remaining

(pixel.green - case.background.green) * (pixel.green - case.background.green) +
(pixel.blue - case.background.blue) * (pixel.blue - case.background.blue)
}
.take((foregroundPixels.size * 0.1f).toInt().coerceAtLeast(1))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this is much better, but "most distant from the background" still isn't quite the same as "fully opaque". In the transparent-text case, the expected unvoted color (#CCFFCC) and the dimmed gray (#D2D2D4) are only ~0.18 apart, which is less than twice the 0.12 tolerance. A wrongly dimmed thumb with partial anti-aliased coverage (about #E4E4E5) is within 0.106 of #CCFFCC and would pass. The coerceAtLeast(1) also means a single pixel can satisfy the check. Sampling known interior pixels of the icon, or requiring a minimum pixel count, would close this off.

(pixel.blue - case.background.blue) * (pixel.blue - case.background.blue)
}
.take((foregroundPixels.size * 0.1f).toInt().coerceAtLeast(1))
val sampledColor = Color(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: if no foreground pixels are found, the averages are NaN and Color(...) throws IllegalArgumentException here, before the mostOpaquePixels.isNotEmpty() check in the assertion runs. The test still fails, but without the helpful message. Asserting non-empty before building sampledColor would keep the context.

spacing = 4.dp,
iconColor = textColor,
selectedIconColor = themeColors.primary,
dimmedIconColor = textColor.copy(alpha = 0.4f),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed with Color(0x668E8E93), thanks!

iconColor = textColor,
selectedIconColor = themeColors.primary,
// Match SwiftUI Color.gray.opacity(0.4); Compose Color.Gray uses a lighter RGB value.
dimmedIconColor = Color(red = 0.5f, green = 0.5f, blue = 0.5f, alpha = 0.4f),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, #8E8E93 at 40% matches SwiftUI Color.gray.opacity(0.4). Thanks!

Comment thread Documentation/style-guide.md Outdated
| `behavior.feedback.showCancelButton` | boolean \| null | `null` | Cancel button visibility. `null` = shown for `"modal"`, hidden for `"action"`. Both set to `false` is honored: Submit and (in action mode) drag-down still dismiss. |
| `behavior.feedback.alwaysDisplay` | boolean | `false` | When `true`, shows the feedback thumbs as soon as the response finishes streaming, bypassing the server's `feedbackEligible` flag. Does not bypass the streaming-complete requirement. |

Before a vote, both thumbs use the concierge message text color. After a vote, the selected thumb uses the primary brand color and the other thumb uses fixed neutral gray (RGB 128, 128, 128) at 40% opacity, matching iOS. The gray tint is independent of the theme's text color and opacity. This applies to both inline and below-message placement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated, thanks!

}
assertTrue(
"${case.name}, below=$showLabel, $vote, $description: expected $expected",
matchingPixels >= 5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, the relative sampling is a nice improvement. Left a couple of follow-up notes on the new version.

Require multiple foreground samples and tighten tint tolerance in the rendered feedback color test. Assert a minimum sample count before calculating the sampled color.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Measure icon coverage using independent black-on-white reference renders and compare each sampled pixel against its coverage-adjusted expected tint. Keep the 0.05 channel tolerance and require at least eight reference samples.

Add regression checks rejecting the wrong dimmed gray and insufficient reference samples. No production code or dependency changes.
@josej-ea
josej-ea merged commit 1b39817 into adobe:dev Nov 14, 2026
11 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.

2 participants