-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Set custom color when applying initial background image #54054
Conversation
Size Change: +606 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
63e1426
to
21c0164
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isDark
calculation uses the cover color to figure out if the text should be light or dark. So setting this should also set isDark
.
@ajlende added the dark check after the media sets custom color. |
@ajlende did some refactoring to use retrieving average color functions once. Got rid of an |
12132cb
to
3787118
Compare
a822e6b
to
999b49c
Compare
I am starting over this one. |
There are a few things to try and achieve with this:
(2.1) and (2.2) make refactoring annoying because:
|
Addressed @ajlende latest review and fixed the behavior to respect the manually set color overlay on load. Also tweaked the use featured image behavior. Updated the OP with a video with current working state. Following a conversation with @richtabor there is the question of when should the overlay be set from the average color of the background image? All the time when a background image is applied or only if there is no overlay color? Or only when the overlay color is not manually set? Ideally we would know the difference between an overlay color manually set by a user and one set by the system. And in this PR we do, but only until the page is reloaded. The best simplification would be to set the overlay from average color of background image only if there is no overlay color and no background image. Otherwise we'd have to save a new attribute, so that when the user switches the background image we can tell if the color is the one from the previous image average color, or if it's set manually, and on media change only suggest if the color is set by the system. We need to decide between:
|
I think this is the correct path, though it can be in a follow-up to get this in. I would expect an overlay color suggested as long as I didn’t manually change the color myself. If I set an overlay color, that color should persist on media change. |
I wonder if we could use the synchronous FAC API on save when an |
…scribe what it means in the contexts used
819e216
to
a3cb7f8
Compare
Closes #44167
The original attempt was using
colorThief
(#22564) and there is another PR (#46908) which I learned after doing this one doing the same thing.Anyway 😬 this PR aims to land the feature.
cover-block-auto-overlay.mp4