def update_char_format(baseformat, color=None, background=None, weight=None, italic=None, underline=None, font=None):
 charformat = QTextCharFormat(baseformat)
 if (color is not None):
  charformat.setForeground(color)
 if (background is not None):
  charformat.setBackground(background)
 if (font is not None):
  charformat.setFont(font)
 else:
  font = update_font(baseformat.font(), weight, italic, underline)
  charformat.setFont(font)
 return charformat

def update_char_format ( baseformat , color = None , background = None , weight = None , italic = None , underline = None , font = None ) : charformat = QTextCharFormat ( baseformat ) if ( color is not None ) : charformat . setForeground ( color ) if ( background is not None ) : charformat . setBackground ( background ) if ( font is not None ) : charformat . setFont ( font ) else : font = update_font ( baseformat . font ( ) , weight , italic , underline ) charformat . setFont ( font ) return charformat
return a copy of baseformat :class:qtextcharformat with updated color .