question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StandardChip placeholder icon color not changing when disabled

See original GitHub issue

StandardChip placeholder icon should have an alpha applied in order to change the color when on disabled state.

Compare:

Screen Shot 2022-07-11 at 15 17 40

Our implementation relies on Chip from androidx.wear.compose.material which seems to implement this functionality. From the kdoc:

In order to correctly render when the Chip is not enabled the icon must set its alpha value to [LocalContentAlpha].

However, our implementation uses Coil’s rememberAsyncImagePainter to display a placeholder, which receives a Painter type as placeholder, and might not work well with that alpha applied in Chip.

Expected outcome from this task

  • PrimaryChip preview for disabled state displays placeholder icon with correct alpha applied
  • SecondaryChip preview for disabled state displays placeholder icon with correct alpha applied
  • Other previews for PrimaryChip and SecondaryChip are not affected
  • PrimaryChip snapshot test for disabled state displays placeholder icon with correct alpha applied
  • SecondaryChip snapshot test for disabled state displays placeholder icon with correct alpha applied
  • Other snapshot tests for PrimaryChip and SecondaryChip are not affected

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yschimkecommented, Aug 30, 2022

@oas004 if you can see it fixed with this, please put up a PR. Thanks!

1reaction
oas004commented, Aug 29, 2022

Hey, I was trying to look into this and I was wondering; is there a reason why you can not just apply a LocalContentAlpha.Current to the image if it is disabled? 😄 From the previews it seems correct, but I got thrown off by this

However, our implementation uses Coil's rememberAsyncImagePainter to display a placeholder, 
which receives a Painter type as placeholder, and might not work well with that alpha applied in Chip.

Does that mean that I would need to deprecate and alter the api to not get a painter as a placeholder? and then use something else than rememberAsyncImagePainter?

With the alpha applied to the images, it looks like this for the placeholder disabled preview

Screenshot 2022-08-29 at 16 49 12
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why on disabled Pseudo class background color of icon ...
Pseudo class disabled only works on input fields , buttons and select. By adding the background color to disabled class it works.
Read more >
An icon doesn't change color when making an instance ...
My icons have the same layer names (“Icon”) and still, color overrides are not preserved. Here you can see a link component with...
Read more >
Disabled people - Free people icons
Free vector icon. Download thousands of free icons of people in SVG, PSD, PNG, EPS, and icon font formats.
Read more >
Changing Icon Color in Iconify SVG Framework
Some icons, such as emoji, have a hardcoded palette that cannot be changed. To change color of a monotone icon simply change text...
Read more >
Chips | Angular Material
Unlike other chips, the user can focus on disabled chip options inside a ... When a chip is not selectable, changes to its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found