Skip to content

Cannot change node color in node editor #1937

Answered by rbrunet
rbrunet asked this question in Support
Discussion options

You must be logged in to vote

I figured out my mistake. I needed to add dpg.theme_component()

import dearpygui.dearpygui as dpg

color = (255, 0, 0)

dpg.create_context()
with dpg.window(label="Node link  animation", width=400, height=400):
    with dpg.node_editor():
        with dpg.node(label="Node 1") as node1:
            with dpg.node_attribute(label="Node A1"):
                dpg.add_input_float(label="F1", width=150)
    with dpg.theme() as item_theme:
        with dpg.theme_component(dpg.mvAll):
            theme_id = dpg.add_theme_color(dpg.mvNodeCol_TitleBar, color, category=dpg.mvThemeCat_Nodes)

dpg.bind_item_theme(node1, item_theme)

dpg.create_viewport(title='Title', width=800, height=600)
dpg.setup_de…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rbrunet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
1 participant