Skip to content

Theme DaxIconButton colors and add filled variant#8823

Open
GerardPaligot wants to merge 2 commits into
developfrom
feature/gerard/compose-icon-button
Open

Theme DaxIconButton colors and add filled variant#8823
GerardPaligot wants to merge 2 commits into
developfrom
feature/gerard/compose-icon-button

Conversation

@GerardPaligot

@GerardPaligot GerardPaligot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1215496415658080/task/1215564036631797?focus=true

Description

Makes the Compose DaxIconButton follow the Compose theme, and adds a filled variant.

  • The icon is now tinted with the button's content color (DuckDuckGoTheme.colors.icons.primary by default) instead of Color.Unspecified. Previously, icons with hard-coded fills (e.g. ic_ai_chat_24_solid_color, which is @color/black) rendered the wrong color in dark mode because the drawable's baked-in color was used instead of the Compose theme.
  • Adds enabled and colors parameters plus DaxIconButtonDefaults (colors = transparent container, filledColors = filled container).
  • Showcases default, filled, and disabled states in the design system internal screen ("Icon Buttons" section).

Steps to test this PR

Design system screen

  • Build & install the internal variant, open Design System → Components → Buttons.
  • Scroll to "Icon Buttons": confirm three Compose icon buttons render — default (transparent), filled, and disabled.
  • Toggle dark/light theme: confirm the icon color follows the theme in all three states.

UI changes

image

Note

Medium Risk
Default icon tinting changes appearance for every existing DaxIconButton call site; behavior is intentional but worth verifying screens that depended on native drawable colors.

Overview
DaxIconButton now applies Compose theme colors instead of leaving icons untinted (Color.Unspecified). Icons use the button’s content color (default DuckDuckGoTheme.colors.icons.primary) so light/dark and disabled states stay correct when drawables have baked-in fills.

The API adds enabled, a colors parameter, and DaxIconButtonDefaults with transparent colors and a filledColors variant (container + disabled container from theme backgrounds). Previews and the internal Components → Buttons screen show default, filled, and disabled examples.

PreviewBox wraps preview LocalContext in ContextThemeWrapper (light/dark DuckDuckGo themes) so painterResource can resolve ?attr/ drawable colors in Studio previews.

Reviewed by Cursor Bugbot for commit 2e2afe7. Bugbot is set up for automated code reviews on this repo. Configure here.

GerardPaligot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@GerardPaligot GerardPaligot marked this pull request as ready for review June 9, 2026 21:39

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8430706. Configure here.

@GerardPaligot GerardPaligot force-pushed the feature/gerard/compose-icon-button branch from 8430706 to 034c083 Compare June 9, 2026 21:49
Comment on lines +117 to +129
Column {
DaxIconButton(
onClick = {},
iconPainter = painterResource(R.drawable.ic_settings_24),
contentDescription = "Settings",
)
DaxIconButton(
onClick = {},
iconPainter = painterResource(R.drawable.ic_settings_24),
contentDescription = "Settings",
colors = DaxIconButtonDefaults.filledColors,
)
}

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.

🔍 With these changes I no longer see the settings icon in the preview. I believe this related to how we tint some Icons, and which is why I went with Color.Unspecified, so that we default to the color in some our our VectorDrawables

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The icon wasn't displayed before my changes too. I've improved our PreviewBox component to configure ContextThemeWrapper and be able to evaluate XML attributes, but we should consider to move this in the DuckDuckGoTheme component to be compatible with interoperability between Compose and XML.

* @param colors Container and content colors; defaults to [DaxIconButtonDefaults.colors].
* @param interactionSource The interaction source for this button.
*
* Asana task: https://app.asana.com/1/137249556945/project/1202857801505092/task/1215540472063931?focus=true

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.

❓Do we want to add this to ADS when it doesn't exist in Figma? If we think it's worthwhile we should propose to be added I guess/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think IconButton is important enough to be added in Figma, what do you think?


@PreviewLightDark
@Composable
private fun DaxIconButtonPreview() {

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.

🔍 I think it would be worthwhile adding a filled+disabled preview as well 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2026-06-16 at 13 49 27

@GerardPaligot GerardPaligot force-pushed the feature/gerard/compose-icon-button branch from 034c083 to 42a17ae Compare June 16, 2026 11:45
Tint the Compose icon button with the theme content color so icons follow
light/dark mode instead of the drawable's baked-in colors. Add a filled
container color variant, and show default, filled, and disabled states in
the design system screen.
- Replace Material IconButtonColors with a DaxIconButtonColors data class, mapped to Material3 inside DaxIconButton (consistent with DaxButton).
- Add a filled + disabled icon button preview.
- PreviewBox applies the DuckDuckGo View theme to LocalContext so painterResource resolves drawable ?attr/daxColor* fills; previews otherwise rendered those vectors transparent.
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