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 mode #1

Closed
kurtextrem opened this issue May 25, 2017 · 7 comments
Closed

Background color mode #1

kurtextrem opened this issue May 25, 2017 · 7 comments

Comments

@kurtextrem
Copy link

Another cool technique would be showing background colors instead of base64 images - that also saves bandwidth. See here: https://csswizardry.com/2016/10/improving-perceived-performance-with-multiple-background-images/
Could be useful to integrate as an option?

@zouhir
Copy link
Owner

zouhir commented May 26, 2017

Thanks for the suggestion! I can add that as an option to suggest a hex CSS color or colors palette as preSrc 🤔

@kurtextrem
Copy link
Author

Sounds awesome :)

@themre
Copy link

themre commented May 26, 2017

or adding array of HEX to generate linear gradient would be awesome

@developit
Copy link

developit commented May 26, 2017

Could return an SVG or a tiny png of a flat color (or gradient). That way the API is always as simple as assigning preSrc. Having different modes produce different objects would be hard to follow.

@zouhir
Copy link
Owner

zouhir commented May 27, 2017

Those are all great ideas! The webpack folks said in the docs "make sure your webpack loader does 1 task only" and they recommended chaining loaders.

We can make lqip-colors-loader that can be chained right after lqip-loader as you see usually see in style and less, sass loaders. and once they chained the final object you get can be like:

{
      "background": "#00D7BC",
      "background-image": "linear-gradient(100deg, #31BADA 0%, #07FFA7 100%)",
      "preSrc": "a-green-and-blue-image-in-base64",
      "src":  "/a-green-and-blue-base-banner-original-source.jpg"
}

that's kind of my thoughts inspired by all previous comments. any thoughts, happy to flip things around to come out with more creative solution! 😃

@shelldandy
Copy link

Wanted to add to the conversation by saying there's a node package that does this:

https://github.com/akfish/node-vibrant

Maybe just plop it in and generate the object as proposed above ☝️

@zouhir
Copy link
Owner

zouhir commented Oct 14, 2017

This has just been released in v2!

thanks for the suggestions literally everyone in this ticket!

@zouhir zouhir closed this as completed Oct 14, 2017
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

5 participants