How to extract default colors from any online shop theme?

Solved

How to extract default colors from any online shop theme?

demib
Shopify Partner
135 13 65

We are working on an app where we would like to set the right default colors as used by the shop using the app. 

 

What is the best way to extract the colors used by any shop - no matter what theme they use? (so it works across all merchants)

SEO Geek since 1996, consultant author and public speaker. Admin of the Shopify SEO Facebook Group

Was your question answered? Kindly mark it as an Accepted Solution 🙂
Accepted Solution (1)

PaulNewton
Shopify Partner
7722 678 1626

This is an accepted solution.

Hey @demib  The closest is the branding api but that's in the storefront api

https://shopify.dev/changelog/brand-settings-now-available-via-storefront-api 

And an upcoming checkoutbranding in unstable

https://shopify.dev/api/admin-graphql/unstable/queries/checkoutBranding 

 

Otherwise it means grabing the settings_data.json from the assets api and reading for commonly named JSON properites like primary_color etc and just setting up a process when new themes are detected to build a map.

 

Or inserting your own liquid file/extension into a theme that pipes out brand properties that are available in liquid https://help.shopify.com/en/manual/promoting-marketing/managing-brand-assets and rendering that into some json to fetch from the frontend.

 

There's also using color palette generation tools that fetchs pages on a website to build a websites color palette.

 

(so it works across all merchants)


Ultimately currently "all" is an unrealistic goal, there is no conformity requirement on the platform for setting the data for colors in themes or stores. It's right up there with trying to guess selectors for different parts of a theme UI, it cannot be 100% reliably automated there will always be a need for remediation for the first time an app encounters a different theme.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


View solution in original post

Replies 2 (2)

PaulNewton
Shopify Partner
7722 678 1626

This is an accepted solution.

Hey @demib  The closest is the branding api but that's in the storefront api

https://shopify.dev/changelog/brand-settings-now-available-via-storefront-api 

And an upcoming checkoutbranding in unstable

https://shopify.dev/api/admin-graphql/unstable/queries/checkoutBranding 

 

Otherwise it means grabing the settings_data.json from the assets api and reading for commonly named JSON properites like primary_color etc and just setting up a process when new themes are detected to build a map.

 

Or inserting your own liquid file/extension into a theme that pipes out brand properties that are available in liquid https://help.shopify.com/en/manual/promoting-marketing/managing-brand-assets and rendering that into some json to fetch from the frontend.

 

There's also using color palette generation tools that fetchs pages on a website to build a websites color palette.

 

(so it works across all merchants)


Ultimately currently "all" is an unrealistic goal, there is no conformity requirement on the platform for setting the data for colors in themes or stores. It's right up there with trying to guess selectors for different parts of a theme UI, it cannot be 100% reliably automated there will always be a need for remediation for the first time an app encounters a different theme.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


demib
Shopify Partner
135 13 65

Thanks a lot. I guess we will have to live with "almost all" 🙂

SEO Geek since 1996, consultant author and public speaker. Admin of the Shopify SEO Facebook Group

Was your question answered? Kindly mark it as an Accepted Solution 🙂