Skip to content

Instantly share code, notes, and snippets.

@nagisa
Created December 1, 2012 17:29
Show Gist options
  • Save nagisa/4183356 to your computer and use it in GitHub Desktop.
Save nagisa/4183356 to your computer and use it in GitHub Desktop.
attrlist = []
def filter_cb(attr, attrlist):
attrlist.append(attr)
return False
color_hex = color.to_color().to_string()
markup = '<span color="{0}"></span>'.format(color_hex)
attrs = Pango.parse_markup(markup, -1, '\01')[1]
attrs.filter(filter_cb, attrlist)
attrlist[0].end_index = GLib.MAXINT32
layout.set_attributes(attrs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment