| Server IP : 93.86.61.54 / Your IP : 216.73.216.206 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/inkscape/extensions/ |
Upload File : |
#!/usr/bin/env python
"""List all colors used in an svg document"""
from collections import defaultdict
import inkex
class ListColours(inkex.ColorExtension):
"""Make the colours darker"""
_counts = defaultdict(int)
def effect(self):
super(ListColours, self).effect()
items = sorted(self._counts.items(), key=lambda v: -v[1])
for color, count in items:
self.msg("{count}: {color}".format(color=color, count=count))
def modify_color(self, name, color):
self._counts[color] += 1
return color
if __name__ == '__main__':
ListColours().run()