gatsby-image opacity not configurable

Created on 13 Aug 2019  路  3Comments  路  Source: gatsbyjs/gatsby

Currently revealed opacity is configured as 1 and unrevealed as 0 and there's no way to override this. I would like to use 0.8 and a backgroundColor of #000 to darken the image a bit.

Something like this, would be ideal:

<Img revealedStyle={{opacity: 0.8}} /> // Having revealedStyle default to {opacity:1}

I can PR if requested.

Most helpful comment

+1 to @tkvw's request, I don't think darkening an image should be considered a niche case!!

All 3 comments

Hey @tkbky! We won't be adding prop like that to gatsby-image as the usecase you presented is quite niche and in our opinion doesn't warrant adding more surface area to gatsby-image.

For cases like that I would recommend vendoring gatsby-image (copy code from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/src/index.js to your project and adjust it locally and use that instead of gatsby-image).

@pieh You have mentioned the wrong person. 馃槵

@tkvw FYI

+1 to @tkvw's request, I don't think darkening an image should be considered a niche case!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benstr picture benstr  路  3Comments

rossPatton picture rossPatton  路  3Comments

ferMartz picture ferMartz  路  3Comments

totsteps picture totsteps  路  3Comments

andykais picture andykais  路  3Comments