Implement foreground

This commit is contained in:
Kovid Goyal 2019-07-02 18:49:01 +05:30
parent 35e531a737
commit 53caa824cf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -471,8 +471,10 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
col = QColorDialog.getColor(Qt.black, self,
_('Choose foreground color'), QColorDialog.ShowAlphaChannel)
if col.isValid():
raise NotImplementedError('TODO')
self.exec_command('foreColor', unicode_type(col.name()))
fmt = QTextCharFormat()
fmt.setForeground(QBrush(col))
with self.editing_cursor() as c:
c.mergeCharFormat(fmt)
def do_background(self):
col = QColorDialog.getColor(Qt.white, self,