Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background color alpha overlap at bottom #250

Closed
drewbitt opened this issue Mar 19, 2020 · 3 comments
Closed

Background color alpha overlap at bottom #250

drewbitt opened this issue Mar 19, 2020 · 3 comments

Comments

@drewbitt
Copy link

Errors in both light and dark mode
new-parser branch

Code:

Html(data: 'Test',
    style: {
      'html': Style(backgroundColor: Colors.black.withAlpha(80))
    });

Example

Most colors .withAlpha have this issue

@DFelten
Copy link
Contributor

DFelten commented Nov 5, 2020

Same issue here. It's not possible to define an alpha value or opacity for colors for attributes within the html content.

@tneotia
Copy link
Collaborator

tneotia commented Feb 10, 2021

I looked into this - it's happening because the colors are getting compounded:

image

When there are multiple items with the same background color on top of each other, and they have some transparency, Flutter is going to render the intersection of those items darker than the original color.

I'm going to see if there's a way to prevent this if this behavior is not in line with HTML spec.

Edit: I found which widget is causing this, its the TextSpan widget, which accepts backgroundColor in its style. However, this behavior is in line with HTML spec:

image

image

With this in mind, I don't know if we should try to fix this, it could prove an issue when others want this behavior. What are your thoughts @erickok ?

@Sub6Resources
Copy link
Owner

Closing, since this is expected behavior

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

No branches or pull requests

4 participants