diff --git a/assets/favicon/.gitignore b/assets/favicon/.gitignore new file mode 100644 index 0000000000..b20a603e1e --- /dev/null +++ b/assets/favicon/.gitignore @@ -0,0 +1 @@ +/tmp.svg diff --git a/assets/favicon/generate b/assets/favicon/generate new file mode 100755 index 0000000000..26033a81d0 --- /dev/null +++ b/assets/favicon/generate @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import xml.etree.ElementTree as ET +import subprocess + +# Generates the favicon images containing unread message counts. + +# Open the SVG and find the number text elements using XPath +tree = ET.parse('orig.svg') +elems = [tree.getroot().findall( + ".//*[@id='%s']/{http://www.w3.org/2000/svg}tspan" % (name,))[0] + for name in ('number_back', 'number_front')] + +for i in xrange(1,100): + # Prepare a modified SVG + s = '%2d' % (i,) + for e in elems: + e.text = s + with open('tmp.svg', 'w') as out: + tree.write(out) + + # Convert to PNG + subprocess.check_call(['inkscape', '--without-gui', '--export-area-page', + '--export-png=../../zephyr/static/images/favicon/favicon-%d.png' % (i,), + 'tmp.svg'])