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

Brand colors are not supported in assets files #2036

Open
bakura10 opened this issue Oct 16, 2022 · 3 comments
Open

Brand colors are not supported in assets files #2036

bakura10 opened this issue Oct 16, 2022 · 3 comments

Comments

@bakura10
Copy link

Hi :),

I have found a bug in the way brand colors are handled for assets file, where it seems that Shopify is not using the latest renderer version. This is not a Dawn specific bug, but a platform bug - which can also affect Dawn - (as always, as we do not have any other way to report platform level bug, I am using this repo, I hope this is ok).

To reproduce the issue:

  1. Create a "icon.svg" file in the "Assets" folder.
  2. Add a random SVG icon, and output a color from general settings, for instance:
<svg width="70" height="70" viewBox="0 0 70 70" xmlns="http://www.w3.org/2000/svg">
    <path fill="{{ settings.background }}" d="M48 36H35.98v12h-2V36H22v-2.02h11.98V22h2v11.98H48"/>
</svg>
  1. In the theme editor, connect the "background" general setting to a brand color (for instance the primary color):

image

  1. Generate the asset URL by using {{ 'icon.svg' | asset_url }}
  2. Open the URL in the browser, Shopify will have transformed it to something like this instead of the correct color (notice the path fill):
<svg width="70" height="70" viewBox="0 0 70 70" xmlns="http://www.w3.org/2000/svg">
    <path fill="{{ shop.brand.colors.primary[0].background }}" d="M48 36H35.98v12h-2V36H22v-2.02h11.98V22h2v11.98H48"/>
</svg>

Thanks

@timdmackey
Copy link

timdmackey commented Nov 5, 2022

I've run into this problem as well just now, using an Archetype theme from the Shopify store. It's not just limited to svg files, this is an issue in my main css file.

Screen Shot 2022-11-04 at 7 57 25 PM

I noticed that the Dawn theme is capable of using brand colors correctly, but the way it does this is rather insane! All the css colors are in a style block on the primary html template. The colors get rendered correctly, but why why why is the theme using an embedded style block for variables if not to get around this specific issue?

@naxorn
Copy link

naxorn commented Jul 6, 2023

FYI: I reported this on the Shopify liquid repo (issue 1654) too, but no luck... Would love to see a public bug tracker for Shopify issues... often reporting bugs through Shopify Support is painful and time consuming.

@shayanabbas
Copy link

I have the same issue

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

4 participants