Class: QgsCodeEditorColorScheme¶
Defines a color scheme for use in QgsCodeEditor
widgets.
Added in version 3.16.
Enums
Color roles. |
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 specified role. |
- class qgis.gui.QgsCodeEditorColorScheme[source]¶
Bases:
object
- __init__(id: str | None = '', name: str | None = '')
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.- Parameters:
id (Optional[str] = '')
name (Optional[str] = '')
- __init__(a0: QgsCodeEditorColorScheme)
- Parameters:
- class ColorRole(*values)¶
Bases:
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 lineSearchMatchBackground
: Background color for search matchesAdded in version 3.38.
- 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¶
- SearchMatchBackground = 35¶
- SelectionBackground = 24¶
- SelectionForeground = 25¶
- SingleQuote = 12¶
- Tag = 20¶
- TripleDoubleQuote = 15¶
- TripleSingleQuote = 14¶
- UnknownTag = 21¶
- color(self, role: QgsCodeEditorColorScheme.ColorRole) QColor [source]¶
Returns the color to use in the editor for the specified
role
.See also
- Parameters:
- Return type:
QColor
- id(self) str [source]¶
Returns the ID of the color scheme, which is a unique, non-translated identifier for the scheme.
- Return type:
str
- name(self) str [source]¶
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)[source]¶
Sets the
color
to use in the editor for the specifiedrole
.See also
- Parameters:
color (Union[QColor, Qt.GlobalColor])