Skip to content

Docked window tab/title bars ignore the theme (mvThemeCol_TitleBg* / mvThemeCol_Tab* not applied when docked) #2659

Description

@rysk-t

Dear PyGui version:

2.3.1

Python version:

3.11.4

Operating system:

Windows 11H2

My issue/question:

When windows are docked, the dock node's tab/title bar keeps the default colors even though a global theme sets mvThemeCol_TitleBgActive / mvThemeCol_Tab*. The same colors apply correctly to floating (non‑docked) windows.

Root cause: ImGui draws a docked node's tab/title bar from the base style (the dockspace host is submitted before the theme is pushed each frame), i.e. outside the per‑item PushStyleColor scope DPG uses for theming. Currently only mvThemeCol_DockingPreview is mirrored into the base style (#1429); the title/tab colors are not.

To Reproduce

import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.configure_app(docking=True, docking_space=True)
dpg.create_viewport(width=680, height=340)

with dpg.theme() as t:
    with dpg.theme_component(dpg.mvAll):
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive, (120, 45, 175))
        dpg.add_theme_color(dpg.mvThemeCol_TabSelected,   (160, 80, 220))
dpg.bind_theme(t)

with dpg.window(label="Alpha"):            dpg.add_text("Alpha")
with dpg.window(label="Beta"):             dpg.add_text("Beta")
with dpg.window(label="Gamma (floating)"): dpg.add_text("floating")

dpg.setup_dearpygui(); dpg.show_viewport()
dpg.start_dearpygui(); dpg.destroy_context()
Dock Alpha and Beta together; leave Gamma floating.

Expected: the docked tab/title bar uses the themed purple.
Actual: the docked tab/title bar stays the default blue, while the floating window's title bar is purple (see screenshot).

Proposed fix
I have a fix ready: mirror the docking‑chrome colors (TitleBg*, Tab*, DockingPreview, DockingEmptyBg) into the base style, but only when a globally‑bound theme is applied (gated by a new mvContext::applyingGlobalTheme flag) so per‑item themes don't leak into the shared base style.
Branch: https://github.com/rysk-t/DearPyGui/tree/color_chg

Happy to open a PR if this approach looks good.

Steps to reproduce:

import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.configure_app(docking=True, docking_space=True)
dpg.create_viewport(width=680, height=340)

with dpg.theme() as t:
    with dpg.theme_component(dpg.mvAll):
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive, (120, 45, 175))
        dpg.add_theme_color(dpg.mvThemeCol_TabSelected,   (160, 80, 220))
dpg.bind_theme(t)

with dpg.window(label="Alpha"):            dpg.add_text("Alpha")
with dpg.window(label="Beta"):             dpg.add_text("Beta")
with dpg.window(label="Gamma (floating)"): dpg.add_text("floating")

dpg.setup_dearpygui(); dpg.show_viewport()
dpg.start_dearpygui(); dpg.destroy_context()
Dock Alpha and Beta together; leave Gamma floating.

Expected: the docked tab/title bar uses the themed purple.
Actual: the docked tab/title bar stays the default blue, while the floating window's title bar is purple (see screenshot).

Expected behavior:

The docked tab/title bar uses the themed purple.
Actual: the docked tab/title bar stays the default blue, while the floating window's title bar is purple (see screenshot).

Screenshots:

N/A

Image

Standalone, minimal, complete and verifiable example:

import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.configure_app(docking=True, docking_space=True)
dpg.create_viewport(width=680, height=340)

with dpg.theme() as t:
    with dpg.theme_component(dpg.mvAll):
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive, (120, 45, 175))
        dpg.add_theme_color(dpg.mvThemeCol_TabSelected,   (160, 80, 220))
dpg.bind_theme(t)

with dpg.window(label="Alpha"):            dpg.add_text("Alpha")
with dpg.window(label="Beta"):             dpg.add_text("Beta")
with dpg.window(label="Gamma (floating)"): dpg.add_text("floating")

dpg.setup_dearpygui(); dpg.show_viewport()
dpg.start_dearpygui(); dpg.destroy_context()
Dock Alpha and Beta together; leave Gamma floating.

Expected: the docked tab/title bar uses the themed purple.
Actual: the docked tab/title bar stays the default blue, while the floating window's title bar is purple (see screenshot).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions