
# ,,Won't you take me to funky town?``
# aka thp just found out that hildon.Window has a set_markup method
# Thomas Perl <thp.io/about>; 2010-11-24

import gtk
import gobject
import hildon
import random

w = hildon.Window()
w.connect('destroy', gtk.main_quit)

text = "Funky Town "*3

# pick one!
colors = random.choice([
    ['#9999ff', '#ff6666', '#9999ff', 'yellow', '#ff99ff', '#99ff99'],
    ['#%2x%2x%2x' % ((x*5,)*3) for x in range(25, 50)],
    ['#%2x%2x%2x' % ((x*10,)*3) for x in range(10, 25)],
])

i = 0
def yo():
    def mk():
        global i
        for a, b in enumerate(text.split()):
            for x, y in enumerate(b):
                z = (colors[(i+(x*-1*(2*(a%2)-1)))%len(colors)], y)
                yield '<span foreground="%s">%s</span>' % z
            yield ' '
        i += 1
    w.set_markup(''.join(mk()))
    return True

gobject.timeout_add(100, yo)

w.show_all()
gtk.main()


