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)
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)
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.
Thanks a lot. I guess we will have to live with “almost all” ![]()