Skip to content

[gatsby-image] color of tracedSVG using Contentful fragmentsΒ #14245

@yesh

Description

@yesh

Hi,

I am trying to change the color of the tracedSVG of images from Contentful using gatsby-image.

Summary

digging in the docs and around the web I found that you can put a traceSVG argument with various options in a graphql query, like this:

traceSVG: { background: "#fbfafc", color: "#dbd4e2" }

like in this example:

galleryImages: allUnsplashImagesYaml(filter: { gallery: { eq: true } }) {
  edges {
    node {
      credit
      title
      localFile {
        childImageSharp {
          fluid(
            maxWidth: 380
            quality: 70
            traceSVG: { background: "#fbfafc", color: "#dbd4e2" }
          ) {
            ...GatsbyImageSharpFluid_tracedSVG
          }
        }
      }
    }
  }
}

but this method is not working for my case, because I use a ContentfulAsset type field, like this:

query projectQuery($title: String!) {
    contentfulProject(title: {
      eq: $title
    }) {
      images {
        fluid(
          maxWidth: 600,
          quality: 95
        ) {
          ...GatsbyContentfulFluid_tracedSVG
        }
      }
    }
  }

in fact, if I try to use the option traceSVG inside the fluid arguments i get this error:

error  Unknown argument "traceSVG" on field "fluid" of type "ContentfulAsset"  graphql/template-strings

does someone know if there is another way to define the background and trace colors of a tracedSVG in a ContentfulAsset?

thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.status: needs reproductionThis issue needs a simplified reproduction of the bug for further troubleshooting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions