WordPress / performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
https://wordpress.org/plugins/performance-lab/
GNU General Public License v2.0
350 stars 94 forks source link

Use dominant color as background color in media modal #354

Open spacedmonkey opened 2 years ago

spacedmonkey commented 2 years ago

Feature Description

Use dominant color as background color in media modal for preview thumbnail.

Screenshot 2022-06-02 at 16 59 53

Follow on from https://github.com/WordPress/performance/issues/19 https://github.com/WordPress/performance/pull/282

mxbclang commented 2 years ago

@felixarntz Looks like this needs to push to 1.4.0 as there isn't a PR, can you confirm?

pbearne commented 2 years ago

I don't think we can add this to the performance plugin as it needs a core patch https://github.com/WordPress/wordpress-develop/compare/trunk...pbearne:wordpress-develop:use_dominat_color_in_media_libary?expand=1

felixarntz commented 2 years ago

Thanks @bethanylang @pbearne. Definitely won't make it in time for 1.3.0, but if it's not feasible in the plugin anyway, let's remove the milestone entirely and keep this simply as a tracking task for the core patch work.

adamsilverstein commented 1 year ago

I don't think we can add this to the performance plugin as it needs a core patch https://github.com/WordPress/wordpress-develop/compare/trunk...pbearne:wordpress-develop:use_dominat_color_in_media_libary?expand=1

Thanks for sharing this code sample @pbearne I see how adding this in core would be much easier, however I'm going to dig in a little more to see if we can add the correct classes to the template. A possible solution would be to unhook core's template and insert our own instead (add_action( 'admin_footer', 'wp_print_media_templates' );)

estlacksensory commented 10 months ago

Is this "dominant color" idea only supposed to exist in the media library? It keeps adding "dominant colors" to PNG images etc., in site layouts etc., where there shouldn't be solid colors, according to design. I keep deinstalling updates of Performance lab and reverting files back to version mentioned in comment above. I'm advising admins and other users against updating this plugin until this is sorted out.

This feature might be useful if it was an option that could be activated or not - per user/admin choice - checkbox?

I'll do a pull or a fork or something if I have time, maybe. Thanks.

felixarntz commented 10 months ago

@estlacksensory The dominant color module adds background colors to newly uploaded images throughout the site. This should only have any visual effect when those images haven't loaded yet though. If you see any adverse effects, could you please open a separate bug issue describing the problem?

Separately, you can always disable the Dominant Color Images module, by navigating to Settings > Performance and toggling off the corresponding checkbox.

estlacksensory commented 10 months ago

Thanks @felixarntz - perhaps this was fixed with a recent update. I'll describe in further detail where I think someone else opened a bug report.