[rfc-i] No, constraining to a custom SVG profile is not trivial

Brian E Carpenter brian.e.carpenter at gmail.com
Thu Jan 16 10:49:33 PST 2020

That's exactly what my Python patch does. If R+G+B > 381 return white else black.

It works pretty well if the contrast in the original is sufficient for legibility.


On 16-Jan-20 17:33, Doug Royer wrote:
> On 1/15/20 8:21 PM, Brian E Carpenter wrote:
>>> Attached is a simple XSLT script that I created that simply rips out invalid elements.
>> The problem with colour/greyscale is that this isn't enough. If you have very dark blue text on a very pale pink background, what happens? svgcheck makes this black on black; my heuristic makes it black on white. What would your script do?
> I use this tool with SVG files that I planned to use in this way.
> I have not needed to solve contrast problems yet. When I do, my plan is to make anything more than 50% black, else white.  It can not handle complex SVG with shades of darkness or complex attribute values (like style). If I get energetic, I could do some contrast computation. Never tried anything that complex with XSLT, might have to do some scripting for that.
> The next rev, I am going to tackle the style attribute. I do not know if it is solvable with XSLT. More of an intellectual exercise than a needed goal. If it gets complex, scripting will do.
>> But I do agree with Phill, this is a non-trivial issue. Currently I think doing new drawings with a simple tool like DIA is the only practical way.
> Yea, DIA and the DOT tools just make stick drawings. You can make nice flow and protocol state drawings with the dot tools (and with PIC for those of you that are troff experts).

More information about the rfc-interest mailing list