Invert the colors of qcad3 icons

QCad is an open-source 2D CAD program I've already been kind of fond of. It runs on Windows, Mac and Linux, its version 2 has been the base of LibreCAD, and version 3, which is a couple of months old already, is a huge evolution after version 2. Their developers have always struggled between the open-source and closed source worlds, trying to turn QCad into a business, and at the same time keeping the code open. This is a very hard and subtle fight, and their commitment to open-source is really impressive. They basically make the code available on github, and also sell a Pro version (which costs around 30 euro and has dwg support).

There are only very small annoyances that make me still stick to draftsight, basically the not very customizable dimension styles, and thing of the same level, but most tools in this new version 3 being written in javascript, they are quite easy to tweak, I'll certainly have a look at it at some point.

One small issue that I already found an easy way to solve is this: All icons are drawn in black, which, on my white-on-black desktop theme, made them almost invisible and qcad therefore almost unusable. I then wrote this little script, that crawls through the qcad source code, opens all the svg files it finds, and changes black color with white:

#!/usr/bin/pythonimport osdef processdir(path):    print "entering " + path    for entry in os.listdir(path):        if os.path.isdir(path + os.sep + entry):            processdir(path + os.sep + entry)        elif entry[-4:] == ".svg":            print "    processing " + path + os.sep + entry            f = open(path + os.sep + entry)            b =            f.close()            b = b.replace( 'stroke="#000"','stroke="#fff"' )            b = b.replace( '#000000;','#ffffff;' )            f = open( path + os.sep + entry,'wb' )            f.write(b)            f.close()processdir(os.getcwd())

To use it, simply paste the above code in a file, save it inside the qcad source folder, make it executable, and run it from there. Not sure if this will work out-of-the-box on Windows, but I believe it should.