Class: QgsCodeEditorColorScheme

class qgis.gui.QgsCodeEditorColorScheme(id: str = '', name: str = '')

Bases: sip.wrapper

Constructor for QgsCodeEditorColorScheme.

The id argument must be set to a unique, non-translated identifier for the color scheme.

The name argument must be set to a translated, user-visible descriptive name of the scheme.

QgsCodeEditorColorScheme(QgsCodeEditorColorScheme)

Defines a color scheme for use in QgsCodeEditor widgets.

New in version 3.16.

Parameters
  • id (str = '') –

  • name

class ColorRole(value)

Bases: enum.IntEnum

Color roles.

  • Default: Default text color

  • Keyword: Keyword color

  • Class: Class color

  • Method: Method color

  • Decoration: Decoration color

  • Number: Number color

  • Comment: Comment color

  • CommentLine: Line comment color

  • CommentBlock: Comment block color

  • Background: Background color

  • Cursor: Cursor color

  • CaretLine: Caret line color

  • SingleQuote: Single quote color

  • DoubleQuote: Double quote color

  • TripleSingleQuote: Triple single quote color

  • TripleDoubleQuote: Triple double quote color

  • Operator: Operator color

  • QuotedOperator: Quoted operator color

  • Identifier: Identifier color

  • QuotedIdentifier: Quoted identifier color

  • Tag: Tag color

  • UnknownTag: Unknown tag

  • MarginBackground: Margin background color

  • MarginForeground: Margin foreground color

  • SelectionBackground: Selection background color

  • SelectionForeground: Selection foreground color

  • MatchedBraceBackground: Matched brace background color

  • MatchedBraceForeground: Matched brace foreground color

  • Edge: Edge color

  • Fold: Fold color

  • Error: Error color

  • ErrorBackground: Error background color

  • FoldIconForeground: Fold icon foreground color

  • FoldIconHalo: Fold icon halo color

  • IndentationGuide: Indentation guide line

Background = 9
CaretLine = 11
Class = 2
Comment = 6
CommentBlock = 8
CommentLine = 7
Cursor = 10
Decoration = 4
Default = 0
DoubleQuote = 13
Edge = 28
Error = 30
ErrorBackground = 31
Fold = 29
FoldIconForeground = 32
FoldIconHalo = 33
Identifier = 18
IndentationGuide = 34
Keyword = 1
MarginBackground = 22
MarginForeground = 23
MatchedBraceBackground = 26
MatchedBraceForeground = 27
Method = 3
Number = 5
Operator = 16
QuotedIdentifier = 19
QuotedOperator = 17
SelectionBackground = 24
SelectionForeground = 25
SingleQuote = 12
Tag = 20
TripleDoubleQuote = 15
TripleSingleQuote = 14
UnknownTag = 21
color(self, role: QgsCodeEditorColorScheme.ColorRole) → QColor

Returns the color to use in the editor for the specified role.

See also

setColor()

Parameters

role (QgsCodeEditorColorScheme.ColorRole) –

Return type

QColor

id(self) → str

Returns the ID of the color scheme, which is a unique, non-translated identifier for the scheme.

Return type

str

name(self) → str

Returns the name of the color scheme, which is the translated, user-visible name of the scheme.

Return type

str

setColor(self, role: QgsCodeEditorColorScheme.ColorRole, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color to use in the editor for the specified role.

See also

color()

Parameters