Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions imnodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,45 @@ void StyleColorsLight(ImNodesStyle* dest)
dest->Colors[ImNodesCol_MiniMapCanvasOutline] = IM_COL32(200, 200, 200, 200);
}

const char* GetStyleColorName(ImNodesCol idx)
{
// Create switch-case from enum with regexp: ImNodesCol_(.*), --> case ImNodesCol_\1: return "\1";
switch (idx)
{
case ImNodesCol_NodeBackground: return "NodeBackground";
case ImNodesCol_NodeBackgroundHovered: return "NodeBackgroundHovered";
case ImNodesCol_NodeBackgroundSelected: return "NodeBackgroundSelected";
case ImNodesCol_NodeOutline: return "NodeOutline";
case ImNodesCol_TitleBar: return "TitleBar";
case ImNodesCol_TitleBarHovered: return "TitleBarHovered";
case ImNodesCol_TitleBarSelected: return "TitleBarSelected";
case ImNodesCol_Link: return "Link";
case ImNodesCol_LinkHovered: return "LinkHovered";
case ImNodesCol_LinkSelected: return "LinkSelected";
case ImNodesCol_Pin: return "Pin";
case ImNodesCol_PinHovered: return "PinHovered";
case ImNodesCol_BoxSelector: return "BoxSelector";
case ImNodesCol_BoxSelectorOutline: return "BoxSelectorOutline";
case ImNodesCol_GridBackground: return "GridBackground";
case ImNodesCol_GridLine: return "GridLine";
case ImNodesCol_GridLinePrimary: return "GridLinePrimary";
case ImNodesCol_MiniMapBackground: return "MiniMapBackground";
case ImNodesCol_MiniMapBackgroundHovered: return "MiniMapBackgroundHovered";
case ImNodesCol_MiniMapOutline: return "MiniMapOutline";
case ImNodesCol_MiniMapOutlineHovered: return "MiniMapOutlineHovered";
case ImNodesCol_MiniMapNodeBackground: return "MiniMapNodeBackground";
case ImNodesCol_MiniMapNodeBackgroundHovered: return "MiniMapNodeBackgroundHovered";
case ImNodesCol_MiniMapNodeBackgroundSelected: return "MiniMapNodeBackgroundSelected";
case ImNodesCol_MiniMapNodeOutline: return "MiniMapNodeOutline";
case ImNodesCol_MiniMapLink: return "MiniMapLink";
case ImNodesCol_MiniMapLinkSelected: return "MiniMapLinkSelected";
case ImNodesCol_MiniMapCanvas: return "MiniMapCanvas";
case ImNodesCol_MiniMapCanvasOutline: return "MiniMapCanvasOutline";
}
IM_ASSERT(0);
return "Unknown";
}

void BeginNodeEditor()
{
IM_ASSERT(GImNodes->CurrentScope == ImNodesScope_None);
Expand Down
2 changes: 2 additions & 0 deletions imnodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ ImNodesStyle& GetStyle();
void StyleColorsDark(ImNodesStyle* dest = NULL); // on by default
void StyleColorsClassic(ImNodesStyle* dest = NULL);
void StyleColorsLight(ImNodesStyle* dest = NULL);
// Get a string corresponding to the enum value (for display, saving, etc.).
const char* GetStyleColorName(ImNodesCol idx);

// The top-level function call. Call this before calling BeginNode/EndNode. Calling this function
// will result the node editor grid workspace being rendered.
Expand Down