tibold / svg-explorer-extension

Extension module for Windows Explorer to render SVG thumbnails, so that you can have an overview of your SVG files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: checked background for transparent SVG.

bvandenbon opened this issue · comments

Thank you for this great project !
Can't thank you guys enough.

Just one thing, that would be convenient to add.

I have a lot of SVG files with white lines in it. That's basically, because these SVG files are used on websites with dark backgrounds.

afbeelding

The preview isn't really useful in those cases. But would be if there was a grayish background instead.

For a more universal solution. My proposal is to render SVG images with an additional checkered background. That's also how Google renders previews of images on their image search website. As a bonus, it also makes it instantly visible if there is a white background or a transparent one.

afbeelding

Kind regards

If you're using windows 10 activate the dark mode! Not the best solution but it works fine for both black and white
image

Well see, I was up to the same request but it's the opposite for me. I do use dark mode but have a lot of black SVGs. As per Ares9323's example, those are very hard to see as well. A gray checkered background would be a neat solution. Alternatively it might be helpful to give the user the option to use a custom color that is then rendered as a background for all transparent SVGs.

This is a tricky one, but the issue is in Windows. If you export that SVG into a PNG with transparent background, you end up with the same issue.
I do like the consistency of it, but maybe we can add a setting somewhere, the toggle the checkered background and/or user specified colors?

Same issue as svenfab. I also use dark mode and have a lot of svg's without explicitly set colors so the fill can be more easily changed through css. So background is one way to accomplish the above, but if it's just the dark mode / default of black SVG fill/stroke, another route may be just reading whether dark mode is enabled and if so, render the svg's in white instead? (That would seemingly be a good "automatic"/quick win for most people, with the ability to select manual colors being an optional user selection?

This would be a generic problem for all Windows apps. Makes me wonder if there's already a property to query somewhere. (later) Stack Overflow has a reg key to look at, and better yet code snippets.

  • can be set / retrieved through the AppsUseLightTheme key at the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize registry path
using System;
using Windows.UI.ViewManagement;

namespace WhatColourAmI
{
    class Program
    {
        static void Main(string[] args)
        {

            var settings = new UISettings();
            var foreground = settings.GetColorValue(UIColorType.Foreground);
            var background = settings.GetColorValue(UIColorType.Background);

            Console.WriteLine($"Foreground {foreground} Background {background}");
        }
    }
}

source: https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application

I do like this idea of switching the default colors based on the selected theme. Will look into implementing it.

PowerToys solves this problem by always using a white background. There is a good argument for the background being deterministic, and not tied to the selected theme. Because there will always be some icons that are more visible on one theme than another, if you use the theme's background color. So personally, I prefer not using the theme to determine the background color. A user setting would be nice, but even just hardcoding it to white (like PowerToys does) or checkered seems like at least a step forward to me (but maybe not everyone else).

Just as a point of reference, IntelliJ IDEA's has an option to render SVG with or without the checkerboard background:
image