Constants and Styles¶
This section documents the constants, type definitions, and style configurations available in Manim DSA.
GraphType¶
- GraphType¶
Type alias for graph representations.
This union type defines all the acceptable formats for representing graphs in Manim DSA:
networkx.DiGraph: A NetworkX directed graph objectlist[list[str]]: Adjacency list with indexes as node namesdict[str, list[str]]: Adjacency dictionary with string node nameslist[list[tuple[str, str | int]]]: Weighted adjacency list with (node, weight) tuples and indexes as node namesdict[str, list[tuple[str, str | int]]]: Weighted adjacency dictionary with (node, weight) tuples
Style Classes¶
MGraphStyle¶
- class MGraphStyle[source]¶
Bases:
objectStyle configuration for
MGraphvisualization.This class provides predefined style configurations that control the appearance of graph nodes, edges, labels, and other visual elements. Each style variant includes settings for colors, fonts, sizes, and other visual properties.
- DEFAULT¶
A default style configuration for graphs.
- BLUE¶
A blue style configuration for graphs.
- Type:
- PURPLE¶
A purple style configuration for graphs.
- Type:
- GREEN¶
A green style configuration for graphs.
- Type:
- class _DefaultStyle¶
Default style configuration for graphs.
Provides a clean, minimal appearance with white elements on transparent backgrounds. This serves as the base style that other variants can inherit from and modify.
- node_circle¶
Configuration for the appearance of graph nodes, including color, stroke width, and radius.
- Type:
- edge_line¶
Configuration for the appearance of graph edges, including color and stroke width.
- Type:
- edge_tip¶
Configuration for the appearance of edge tips, including stroke width, fill opacity, and color.
- Type:
- edge_weight¶
Configuration for the appearance of edge weight labels, including color, font size, and font.
- Type:
- class _BlueStyle¶
Bases:
_DefaultStyleBlue style configuration for graphs.
Inherits from
_DefaultStyleand modifies the node circle color and fill color to blue shades, providing a visually distinct appearance for graph nodes.
- class _PurpleStyle¶
Bases:
_DefaultStylePurple style configuration for graphs.
Inherits from
_DefaultStyleand modifies the node circle color and fill color to purple shades, providing a visually distinct appearance for graph nodes.
- class _GreenStyle¶
Bases:
_DefaultStyleGreen style configuration for graphs.
Inherits from
_DefaultStyleand modifies the node circle color and fill color to green shades, providing a visually distinct appearance for graph nodes.
MTreeStyle¶
- class MTreeStyle[source]¶
Bases:
MGraphStyleStyle configuration for
MTreevisualization.This class provides predefined style configurations that control the appearance of tree nodes, edges, labels, and layout properties. Each style variant includes settings for colors, fonts, sizes, spacing, and other visual properties.
- DEFAULT¶
A default style configuration for trees.
- Type:
- BLUE¶
A blue style configuration for trees.
- Type:
- PURPLE¶
A purple style configuration for trees.
- Type:
- GREEN¶
A green style configuration for trees.
- Type:
- class _DefaultStyle¶
Default style configuration for trees.
Inherits from
_DefaultStyleand adds tree-specific layout properties for horizontal and vertical spacing between nodes.
- class _BlueStyle¶
Bases:
_DefaultStyle,_BlueStyleBlue style configuration for trees.
Combines the tree layout properties from
_DefaultStylewith the blue color scheme from_BlueStyle.
- class _PurpleStyle¶
Bases:
_DefaultStyle,_PurpleStylePurple style configuration for trees.
Combines the tree layout properties from
_DefaultStylewith the purple color scheme from_PurpleStyle.
- class _GreenStyle¶
Bases:
_DefaultStyle,_GreenStyleGreen style configuration for trees. Combines the tree layout properties from
_DefaultStylewith the green color scheme from_GreenStyle.
MCollectionStyle¶
- class MCollectionStyle[source]¶
Bases:
objectStyle configuration for
MCollectionvisualization.This class provides predefined style configurations that control the appearance of collection elements including squares, text values, and other visual properties. Each style variant includes settings for colors, fonts, sizes, and other visual properties.
- DEFAULT¶
A default style configuration for collections.
- BLUE¶
A blue style configuration for collections.
- PURPLE¶
A purple style configuration for collections.
- GREEN¶
A green style configuration for collections.
- class _DefaultStyle¶
Default style configuration for collections.
Provides a clean, minimal appearance with white elements on transparent backgrounds. This serves as the base style that other collection variants can inherit from and modify.
- square¶
Configuration for the appearance of collection element squares, including color, stroke width, and dimensions.
- Type:
- class _BlueStyle¶
Bases:
_DefaultStyleBlue style configuration for collections.
Inherits from
_DefaultStyleand modifies the square color and fill color to blue shades, providing a visually distinct appearance for collection elements.
- class _PurpleStyle¶
Bases:
_DefaultStylePurple style configuration for collections.
Inherits from
_DefaultStyleand modifies the square color and fill color to purple shades, providing a visually distinct appearance for collection elements.
- class _GreenStyle¶
Bases:
_DefaultStyleGreen style configuration for collections.
Inherits from
_DefaultStyleand modifies the square color and fill color to green shades, providing a visually distinct appearance for collection elements.
MStackStyle¶
- class MStackStyle[source]¶
Bases:
MCollectionStyleStyle configuration for
MStackvisualization.This class provides predefined style configurations that control the appearance of stack elements, containers, and other visual properties. Each style variant includes settings for colors, fonts, sizes, and other visual properties.
- DEFAULT¶
A default style configuration for stacks.
- BLUE¶
A blue style configuration for stacks.
- Type:
- PURPLE¶
A purple style configuration for stacks.
- Type:
- GREEN¶
A green style configuration for stacks.
- Type:
- class _DefaultStyle¶
Default style configuration for stacks.
Inherits from
_DefaultStyleand adds stack-specific container styling properties.
- class _BlueStyle¶
Bases:
_DefaultStyle,_BlueStyleBlue style configuration for stacks.
Combines the stack container properties from
_DefaultStylewith the blue color scheme from_BlueStyle.
- class _PurpleStyle¶
Bases:
_DefaultStyle,_PurpleStylePurple style configuration for stacks.
Combines the stack container properties from
_DefaultStylewith the purple color scheme from_PurpleStyle.
- class _GreenStyle¶
Bases:
_DefaultStyle,_GreenStyleGreen style configuration for stacks.
Combines the stack container properties from
_DefaultStylewith the green color scheme from_GreenStyle.
MArrayStyle¶
- class MArrayStyle[source]¶
Bases:
MCollectionStyleStyle configuration for
MArrayvisualization.This class provides predefined style configurations that control the appearance of array elements, indices, and other visual properties. Each style variant includes settings for colors, fonts, sizes, and other visual properties.
- DEFAULT¶
A default style configuration for arrays.
- BLUE¶
A blue style configuration for arrays.
- Type:
- PURPLE¶
A purple style configuration for arrays.
- Type:
- GREEN¶
A green style configuration for arrays.
- Type:
- class _DefaultStyle¶
Default style configuration for arrays.
Inherits from
_DefaultStyleand adds array-specific index styling properties.
- class _BlueStyle¶
Bases:
_DefaultStyle,_BlueStyleBlue style configuration for arrays.
Combines the array index properties from
_DefaultStylewith the blue color scheme from_BlueStyle.
- class _PurpleStyle¶
Bases:
_DefaultStyle,_PurpleStylePurple style configuration for arrays.
Combines the array index properties from
_DefaultStylewith the purple color scheme from_PurpleStyle.
- class _GreenStyle¶
Bases:
_DefaultStyle,_GreenStyleGreen style configuration for arrays.
Combines the array index properties from
_DefaultStylewith the green color scheme from_GreenStyle.
MVariableStyle¶
- class MVariableStyle[source]¶
Bases:
MCollectionStyleStyle configuration for
MVariablevisualization.This class provides predefined style configurations that control the appearance of variable elements and their values. Each style variant includes settings for colors, fonts, sizes, and other visual properties.
- DEFAULT¶
A default style configuration for variables.
- BLUE¶
A blue style configuration for variables.
- PURPLE¶
A purple style configuration for variables.
- GREEN¶
A green style configuration for variables.
- class _DefaultStyle¶
Default style configuration for variables.
Inherits from
_DefaultStyleand provides the base styling for variable visualization elements.
- class _BlueStyle¶
Bases:
_DefaultStyle,_BlueStyleBlue style configuration for variables. Combines the variable properties from
_DefaultStylewith the blue color scheme from_BlueStyle.
- class _PurpleStyle¶
Bases:
_DefaultStyle,_PurpleStylePurple style configuration for variables. Combines the variable properties from
_DefaultStylewith the purple color scheme from_PurpleStyle.
- class _GreenStyle¶
Bases:
_DefaultStyle,_GreenStyleGreen style configuration for variables.
Combines the variable properties from
_DefaultStylewith the green color scheme from_GreenStyle.