1#!/usr/local/bin/python3.8 2"""Remove colors""" 3 4import inkex 5 6class Desaturate(inkex.ColorExtension): 7 """Remove color but maintain intesity""" 8 def modify_color(self, name, color): 9 lum = (max(color.red, color.green, color.blue) \ 10 + min(color.red, color.green, color.blue)) // 2 11 return inkex.Color((int(round(lum)), int(round(lum)), int(round(lum)))) 12 13if __name__ == '__main__': 14 Desaturate().run() 15