ZhangJian1713 / vscode-image-viewer

MIT License
17 stars 6 forks source link

[Feature Request] Checkerboard Pattern as Image Background #16

Open RichardWepner opened 9 months ago

RichardWepner commented 9 months ago

I was recently installing this plugin to see if it might be useful for me, tried it in the project I'm currently working on, but no images were visible. The reason was simply that, since it's a game project (Unity as engine to be more precise), it's common for single-color icons to use only white and transparent so that they can be tinted at runtime to whatever color is needed instead of having multiple versions of the same icon. Since most of the first few images were icons like these, and since the background color is white by default, I didn't see anything (until I clicked on one).

Many tools, including the Google image search, use a checkerboard pattern as a background in order for transparent images to have a background image that contains some contrast. You can check the behavior of google by searching for anything that could be used as an icon (I was testing it with the search term "sun"), selecting "transparent" as color (hidden behind "tools") and clicking on a search result. The preview should use a background pattern.

Considerations

If this Issue is getting picked up, please not that the background pattern is typically not scaled but repeated when scaling up or down the displayed image, i. e. the background is always displayed with the same scaling.

I could imagine that using the/a pattern background as default background might be more desirable in general. However, I would also understand that for compatibility reasons white would still be kept as default background.

Nice to Haves

Some tools might use a different pattern for the background, e. g. crosses. It would be nice to have multiple patterns as options, but I don't see this as a criteria for marking this issue as "done".

It could be nice if the user could select their own Pattern image. However, if the settings is done project specific, the path needs to be relative to the project directory (either through a relative path or through VSCode variables). From my perspective it would be fine to expect input from the user to defined this path e. g. through the regular preferences interface. I think however that this is really just a nice to have and not necessary to mark this issue as "done".

It appears as if the extension is not using the regular VSCode settings/preferences. If custom backgrounds are added to the extension, it might make sense to store this using VSCode settings instead of how the settings are currently stored - I assume it's outside of the project directory, but I didn't check.

ZhangJian1713 commented 9 months ago

That makes sense, I will add it soon