Class ThemeResources
Provides theme-aware resource access for FlowCanvas components.
All colors can be customized by defining resources in your App.axaml:
<Application.Resources>
<SolidColorBrush x:Key="FlowCanvasNodeBackground" Color="#2D2D30"/>
<SolidColorBrush x:Key="FlowCanvasNodeBorder" Color="#4682B4"/>
<!-- etc. -->
</Application.Resources>
Available resource keys:
- Canvas: FlowCanvasBackground, FlowCanvasGridColor
- Node: FlowCanvasNodeBackground, FlowCanvasNodeBorder, FlowCanvasNodeSelectedBorder, FlowCanvasNodeText
- Input Node: FlowCanvasInputNodeBackground, FlowCanvasInputNodeBorder, FlowCanvasInputNodeText, FlowCanvasInputNodeIcon
- Output Node: FlowCanvasOutputNodeBackground, FlowCanvasOutputNodeBorder, FlowCanvasOutputNodeText, FlowCanvasOutputNodeIcon
- Edge: FlowCanvasEdgeStroke, FlowCanvasEdgeSelectedStroke
- Port: FlowCanvasPortBackground, FlowCanvasPortBorder, FlowCanvasPortHover, FlowCanvasPortValidConnection, FlowCanvasPortInvalidConnection
- Group: FlowCanvasGroupBackground, FlowCanvasGroupBorder, FlowCanvasGroupLabelText
- Selection: FlowCanvasSelectionBoxFill, FlowCanvasSelectionBoxStroke
- Minimap: FlowCanvasMinimapBackground, FlowCanvasMinimapViewportFill, FlowCanvasMinimapViewportStroke
public class ThemeResources
- Inheritance
-
ThemeResources
- Inherited Members
Constructors
ThemeResources(StyledElement)
public ThemeResources(StyledElement element)
Parameters
elementStyledElement
Properties
Background
public IBrush Background { get; }
Property Value
- IBrush
EdgeSelectedStroke
public IBrush EdgeSelectedStroke { get; }
Property Value
- IBrush
EdgeStroke
public IBrush EdgeStroke { get; }
Property Value
- IBrush
GridColor
public IBrush GridColor { get; }
Property Value
- IBrush
GroupBackground
public IBrush GroupBackground { get; }
Property Value
- IBrush
GroupBodyBackground
public IBrush GroupBodyBackground { get; }
Property Value
- IBrush
GroupBorder
public IBrush GroupBorder { get; }
Property Value
- IBrush
GroupButtonBackground
Background for group collapse/expand button.
public IBrush GroupButtonBackground { get; }
Property Value
- IBrush
GroupButtonHover
Hover background for group collapse/expand button.
public IBrush GroupButtonHover { get; }
Property Value
- IBrush
GroupHeaderBackground
public IBrush GroupHeaderBackground { get; }
Property Value
- IBrush
GroupHeaderHover
public IBrush GroupHeaderHover { get; }
Property Value
- IBrush
GroupHeaderText
public IBrush GroupHeaderText { get; }
Property Value
- IBrush
GroupLabelText
public IBrush GroupLabelText { get; }
Property Value
- IBrush
HeaderedNodeBodyBackground
Body background color for headered nodes.
public IBrush HeaderedNodeBodyBackground { get; }
Property Value
- IBrush
HeaderedNodeBorder
Border color for headered nodes.
public IBrush HeaderedNodeBorder { get; }
Property Value
- IBrush
HeaderedNodeHeaderBackground
Header background color for headered nodes (semi-transparent glassy effect).
public IBrush HeaderedNodeHeaderBackground { get; }
Property Value
- IBrush
HeaderedNodeHeaderText
Header text color for headered nodes.
public IBrush HeaderedNodeHeaderText { get; }
Property Value
- IBrush
HeaderedNodeShadow
Shadow color for headered nodes.
public Color HeaderedNodeShadow { get; }
Property Value
- Color
InputNodeBackground
public IBrush InputNodeBackground { get; }
Property Value
- IBrush
InputNodeBorder
public IBrush InputNodeBorder { get; }
Property Value
- IBrush
InputNodeIcon
public IBrush InputNodeIcon { get; }
Property Value
- IBrush
InputNodeText
public IBrush InputNodeText { get; }
Property Value
- IBrush
InteractiveAccent
Accent color for interactive controls (radio buttons, checkboxes, etc.). Falls back to PrimaryBrush from ShadUI theme, then to a default blue.
public IBrush InteractiveAccent { get; }
Property Value
- IBrush
InteractiveMutedText
Foreground for muted/placeholder text in interactive nodes.
public IBrush InteractiveMutedText { get; }
Property Value
- IBrush
InteractivePreviewBackground
Background for preview areas in interactive nodes.
public IBrush InteractivePreviewBackground { get; }
Property Value
- IBrush
InteractivePreviewText
Foreground for preview placeholder text.
public IBrush InteractivePreviewText { get; }
Property Value
- IBrush
InteractiveValueBackground
Background for value display containers (output nodes, etc.).
public IBrush InteractiveValueBackground { get; }
Property Value
- IBrush
IsLightTheme
Determines if the current theme is light or dark. Cached for performance - call InvalidateThemeCache() if theme changes.
public bool IsLightTheme { get; }
Property Value
MinimapBackground
public IBrush MinimapBackground { get; }
Property Value
- IBrush
MinimapViewportFill
public IBrush MinimapViewportFill { get; }
Property Value
- IBrush
MinimapViewportStroke
public IBrush MinimapViewportStroke { get; }
Property Value
- IBrush
NodeBackground
public IBrush NodeBackground { get; }
Property Value
- IBrush
NodeBorder
public IBrush NodeBorder { get; }
Property Value
- IBrush
NodeHighlightedBorder
Border color for highlighted nodes (e.g., search results, analysis feedback). Default is yellow/amber for visibility.
public IBrush NodeHighlightedBorder { get; }
Property Value
- IBrush
NodeSelectedBorder
public IBrush NodeSelectedBorder { get; }
Property Value
- IBrush
NodeShadow
Shadow color for default nodes.
public Color NodeShadow { get; }
Property Value
- Color
NodeText
public IBrush NodeText { get; }
Property Value
- IBrush
OutputNodeBackground
public IBrush OutputNodeBackground { get; }
Property Value
- IBrush
OutputNodeBorder
public IBrush OutputNodeBorder { get; }
Property Value
- IBrush
OutputNodeIcon
public IBrush OutputNodeIcon { get; }
Property Value
- IBrush
OutputNodeText
public IBrush OutputNodeText { get; }
Property Value
- IBrush
PortBackground
public IBrush PortBackground { get; }
Property Value
- IBrush
PortBorder
public IBrush PortBorder { get; }
Property Value
- IBrush
PortHover
public IBrush PortHover { get; }
Property Value
- IBrush
PortHoverBackground
Background color for hovered ports. Falls back to PortHover if not set.
public IBrush? PortHoverBackground { get; }
Property Value
- IBrush
PortHoverBorder
Border color for hovered ports. Falls back to PortHover if not set.
public IBrush? PortHoverBorder { get; }
Property Value
- IBrush
PortInvalidConnection
public IBrush PortInvalidConnection { get; }
Property Value
- IBrush
PortValidConnection
public IBrush PortValidConnection { get; }
Property Value
- IBrush
SelectionBoxFill
public IBrush SelectionBoxFill { get; }
Property Value
- IBrush
SelectionBoxStroke
public IBrush SelectionBoxStroke { get; }
Property Value
- IBrush
ToolbarBackground
Background for toolbars and floating UI elements.
public IBrush ToolbarBackground { get; }
Property Value
- IBrush
ToolbarBorder
Border for toolbars and floating UI elements.
public IBrush ToolbarBorder { get; }
Property Value
- IBrush
Methods
GetBrush(string, string)
Gets a brush resource with a fallback color.
public IBrush GetBrush(string key, string fallbackColor)
Parameters
Returns
- IBrush
GetColor(string, string)
Gets a color resource with a fallback value.
public Color GetColor(string key, string fallbackColor)
Parameters
Returns
- Color
GetResource<T>(string, T)
Gets a theme resource with a fallback value.
public T GetResource<T>(string key, T fallback) where T : class
Parameters
keystringfallbackT
Returns
- T
Type Parameters
T
InvalidateThemeCache()
Invalidates the cached theme detection. Call this when the theme changes.
public void InvalidateThemeCache()
TryGetBrush(string)
Tries to get a brush resource, returning null if not found.
public IBrush? TryGetBrush(string key)
Parameters
keystring
Returns
- IBrush
TryGetResource<T>(string)
Tries to get a resource, returning null if not found.
public T? TryGetResource<T>(string key) where T : class
Parameters
keystring
Returns
- T
Type Parameters
T