Skip to content

Color scheme

The color scheme controls the colours used for nodes, edges and sockets.

nodeeditor.node_colors_config

A module for centralized color configuration for the Node Editor.

This module provides a single point to manage and update all colors used in: - Edge graphics (default, selected, hovered, dragging) - Socket graphics (background colors per type, highlighting, outlines)

BaseColors

Base class for color configurations _Parameters: - _default: Default color - _selected: Selected color - _hovered: Hovered color - _dragging: Dragging color

default property writable

default

Get default edge color

selected property writable

selected

Get selected edge color

hovered property writable

hovered

Get hovered edge color

EdgeColors

Bases: BaseColors

Configuration for Edge colors

default property writable

default

Get default edge color

selected property writable

selected

Get selected edge color

hovered property writable

hovered

Get hovered edge color

dragging property writable

dragging

Get dragging edge color

set_all

set_all(
    default=None, selected=None, hovered=None, dragging=None
)

Set all edge colors at once

:param default: Default edge color :param selected: Selected edge color :param hovered: Hovered edge color :param dragging: Dragging edge color

SocketColors

Bases: BaseColors

Configuration for Socket colors

outline property writable

outline

Get socket outline color

highlight property writable

highlight

Get socket highlight color

get_type_color

get_type_color(socket_type)

Get color for a specific socket type

:param socket_type: Socket type index :return: QColor for the socket type

set_type_color

set_type_color(socket_type, color)

Set color for a specific socket type

:param socket_type: Socket type index :param color: Color to set

set_type_colors

set_type_colors(colors)

Set all socket type colors at once

:param colors: List of colors

get_all_type_colors

get_all_type_colors()

Get all socket type colors

:return: List of QColor objects

set_all

set_all(outline=None, highlight=None, type_colors=None)

Set all socket colors at once

:param outline: Socket outline color :param highlight: Socket highlight color :param type_colors: List of socket type colors

NodesColors

Bases: BaseColors

Configuration for Node colors

This class reuses the EdgeColors structure to define colors for nodes.

NodeEditorColorScheme

Global color scheme configuration for Node Editor

This class provides a centralized way to manage and update all colors used in the node editor, including edge colors and socket colors.

Example: >>> scheme = NodeEditorColorScheme() >>> scheme.edges.default = "#FF0000" # Red edges >>> scheme.sockets.highlight = "#00FF00" # Green highlights

get_instance classmethod

get_instance()

Get the singleton instance of the color scheme

:return: NodeEditorColorScheme instance

reset_to_defaults

reset_to_defaults()

Reset all colors to their default values

to_dict

to_dict()

Export current color scheme to dictionary

:return: Dictionary representation of the color scheme

from_dict

from_dict(config)

Import color scheme from dictionary

:param config: Dictionary with color configuration

get_color_scheme

get_color_scheme()

Get the global color scheme instance

:return: NodeEditorColorScheme instance