Class: QgsCodeEditorColorScheme¶
- class qgis.gui.QgsCodeEditorColorScheme¶
Bases:
sip.wrapper
Defines a color scheme for use in
QgsCodeEditor
widgets.Added in version 3.16.
QgsCodeEditorColorScheme(id: str = ‘’, name: str = ‘’) 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
)Enums
Bases:
enum.IntEnum
Methods
Returns the color to use in the editor for the specified
role
.Returns the ID of the color scheme, which is a unique, non-translated identifier for the scheme.
Returns the name of the color scheme, which is the translated, user-visible name of the scheme.
Sets the
color
to use in the editor for the specifiedrole
.- class ColorRole(value)¶
Bases:
enum.IntEnum
Color roles.
Default
: Default text colorKeyword
: Keyword colorClass
: Class colorMethod
: Method colorDecoration
: Decoration colorNumber
: Number colorComment
: Comment colorCommentLine
: Line comment colorCommentBlock
: Comment block colorBackground
: Background colorCursor
: Cursor colorCaretLine
: Caret line colorSingleQuote
: Single quote colorDoubleQuote
: Double quote colorTripleSingleQuote
: Triple single quote colorTripleDoubleQuote
: Triple double quote colorOperator
: Operator colorQuotedOperator
: Quoted operator colorIdentifier
: Identifier colorQuotedIdentifier
: Quoted identifier colorTag
: Tag colorUnknownTag
: Unknown tagMarginBackground
: Margin background colorMarginForeground
: Margin foreground colorSelectionBackground
: Selection background colorSelectionForeground
: Selection foreground colorMatchedBraceBackground
: Matched brace background colorMatchedBraceForeground
: Matched brace foreground colorEdge
: Edge colorFold
: Fold colorError
: Error colorErrorBackground
: Error background colorFoldIconForeground
: Fold icon foreground colorFoldIconHalo
: Fold icon halo colorIndentationGuide
: 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
- Parameters:
- 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: QColor | Qt.GlobalColor | QGradient)¶
Sets the
color
to use in the editor for the specifiedrole
.See also
- Parameters:
color (Union[QColor)