def color_icon(color): pixmap = QPixmap(12, 12) if color is None: color = Color(0, 0, 0, 0) pixmap.fill(get_cached_qcolor(color)) icg = IconImage(image=Image(_tkdata=pixmap.toImage())) return Icon(images=[icg])