Skip to content

fix: background color of figure was not computed properly#1603

Merged
martinRenou merged 1 commit intobqplot:0.12.xfrom
maartenbreddels:fix_background_color_image
Jul 11, 2023
Merged

fix: background color of figure was not computed properly#1603
martinRenou merged 1 commit intobqplot:0.12.xfrom
maartenbreddels:fix_background_color_image

Conversation

@maartenbreddels
Copy link
Copy Markdown
Member

On the screen, it is not the computed background color that is seen by a user. Since DOM elements can be transparent, the background color might be one of the parent elements. This is why we need to traverse the DOM tree to find the background color of the first non-transparent parent element.

A more sophisticated solution would be to also use blending when there is a non-fully transparent background color. I think that might be a bit overkill for now.

See also spacetelescope/jdaviz#2264 (comment)

@maartenbreddels
Copy link
Copy Markdown
Member Author

Note that before we would get a different background color in voila and notebook because of style definitions on body. Now we get a white background color for both! :)
I also tested this with jupyter lab and dark themes, which works nicely.

On the screen, it is not the computed background color that is seen
by a user. Since DOM elements can be transparent, the background
color might be one of the parent elements. This is why we need to
traverse the DOM tree to find the background color of the first
non-transparent parent element.

A more sophisticated solution would be to also use blending when
there is a non-fully transparent background color. I think that
might be a bit overkill for now.

See also spacetelescope/jdaviz#2264 (comment)
@maartenbreddels maartenbreddels force-pushed the fix_background_color_image branch from 084b79c to ec48175 Compare July 4, 2023 14:43
Copy link
Copy Markdown
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks!

@martinRenou martinRenou merged commit d6c1c43 into bqplot:0.12.x Jul 11, 2023
@martinRenou
Copy link
Copy Markdown
Member

meeseeksdev please backport to master

@martinRenou martinRenou deleted the fix_background_color_image branch July 11, 2023 13:14
@lumberbot-app
Copy link
Copy Markdown

lumberbot-app bot commented Jul 11, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout master
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 d6c1c4312536f364528b1d82d13de4dfd5231328
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #1603: fix: background color of figure was not computed properly'
  1. Push to a named branch:
git push YOURFORK master:auto-backport-of-pr-1603-on-master
  1. Create a PR against branch master, I would have named this PR:

"Backport PR #1603 on branch master (fix: background color of figure was not computed properly)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

martinRenou pushed a commit to martinRenou/bqplot that referenced this pull request Jul 11, 2023
On the screen, it is not the computed background color that is seen
by a user. Since DOM elements can be transparent, the background
color might be one of the parent elements. This is why we need to
traverse the DOM tree to find the background color of the first
non-transparent parent element.

A more sophisticated solution would be to also use blending when
there is a non-fully transparent background color. I think that
might be a bit overkill for now.

See also spacetelescope/jdaviz#2264 (comment)
martinRenou added a commit that referenced this pull request Jul 11, 2023
)

On the screen, it is not the computed background color that is seen
by a user. Since DOM elements can be transparent, the background
color might be one of the parent elements. This is why we need to
traverse the DOM tree to find the background color of the first
non-transparent parent element.

A more sophisticated solution would be to also use blending when
there is a non-fully transparent background color. I think that
might be a bit overkill for now.

See also spacetelescope/jdaviz#2264 (comment)

Co-authored-by: Maarten Breddels <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants