netlist_carpentry.vis.styling.format
¶
Classes:
FormatDefinition
¶
Bases: BaseModel
Methods:
-
copy_–Alias for self.model_copy(update).
-
merge–Merges the current object together with another FormatDefinition object into a new object.
Attributes:
-
background_color(Optional[str]) –Node background color as a plain string, e.g.
'red'or hex code, e.g.'#ABCDEF'. -
background_opacity(Optional[str]) –Node background opacity from 0 (transparent) to 1 (opaque), e.g.
'0.5'. -
border(Optional[str]) –Shorthand for
border-width border-style (required) border-color, e.g.'solid'or'5px dotted blue'. -
border_color(Optional[str]) –Node border color as a plain string, e.g.
'black'or hex code, e.g.'#ABCDEF'. -
border_radius(Optional[str]) –Node border corner radius, e.g.
'5px'. -
border_style(Union[str, BorderStyleLiteral, None]) –Node border style, e.g.
'solid'or'dashed'. -
border_width(Optional[str]) –Node border width, e.g.
'2px'. -
box_shadow(Optional[str]) –Node box shadow effect, e.g.
'2px 2px 5px #ABCDEF'. -
color(Optional[str]) –Node text color as a plain string, e.g.
'red'or hex code, e.g.'#ABCDEF'. -
curve_style(Union[str, CurveStyleLiteral, None]) –Style of edges curvature, e.g.
'bezier','unbundled-bezier', or'source-target'. -
font_family(Optional[str]) –Node or edge label font family, e.g.
'sans-serif'or'monospace'. -
font_size(Optional[str]) –Node or edge label text size, e.g.
'14px'. -
font_style(Union[str, FontStyleLiteral, None]) –Node or edge label font style, e.g.
'italic','oblique', or'normal'. -
font_weight(Union[str, FontWeightLiteral, None]) –Node or edge label font weight, e.g.
'normal','bold','bolder','lighter', or a number from 100 to 900. -
height(Optional[str]) –Node height, e.g.
'80px'. -
label(Optional[str]) –Node or edge label as plain text.
-
left(Optional[str]) –Node horizontal position from the left edge, e.g.
'100px'. -
line_color(Optional[str]) –Edge color as a plain string, e.g.
'red'or hex code, e.g.'#ABCDEF'. -
line_dash_pattern(Optional[str]) –Edge line dash pattern, e.g.
'4,2'for dashed lines or'2,2'for dotted lines. -
line_height(Optional[str]) –Line height multiplier for text, e.g.
'1.2'. -
line_style(Union[str, LineStyleLiteral, None]) –Edge line style, e.g.
'solid','dashed', or'dotted'. -
line_width(Optional[str]) –Edge line width, e.g.
'2px'. -
max_width(Optional[str]) –Maximum node width, e.g.
'200px'. -
min_width(Optional[str]) –Minimum node width, e.g.
'50px'. -
padding(Optional[str]) –Node internal padding, e.g.
'10px'. -
padding_bottom(Optional[str]) –Node internal bottom padding, e.g.
'10px'. -
padding_left(Optional[str]) –Node internal left padding, e.g.
'10px'. -
padding_right(Optional[str]) –Node internal right padding, e.g.
'10px'. -
padding_top(Optional[str]) –Node internal top padding, e.g.
'10px'. -
position(Union[str, PositionLiteral, None]) –Node position as coordinates, e.g.
'{x: 100, y: 200}'. -
shape(Union[str, ShapeLiteral, None]) –Node shape, e.g.
'rectangle','ellipse','circle','diamond','triangle', etc. -
target_arrow_color(Optional[str]) –Edge arrow color as a plain string, e.g.
'red'or hex code, e.g.'#ABCDEF'. -
target_arrow_shape(Union[str, ArrowShapeLiteral, None]) –Edge arrow shape, e.g.
'triangle','vee','circle','diamond','none', etc. -
text_background_color(Optional[str]) –Text background fill color, e.g.
'white'or hex code,'#ABCDEF'. -
text_background_opacity(Optional[str]) –Text background opacity from 0 (transparent) to 1 (opaque), e.g.
'0.5'. -
text_background_padding(Optional[str]) –Padding around text background, e.g.
'5px'. -
text_halign(Union[str, TextHAlignLiteral, None]) –Horizontal alignment of node or edge text, e.g.
'center','left', or'right'. -
text_max_width(Optional[str]) –Maximum text width before wrapping, e.g.
'150px'. -
text_min_width(Optional[str]) –Minimum text width before wrapping, e.g.
'150px'. -
text_outline_color(Optional[str]) –Text outline/stroke color, e.g.
'white'or hex code,'#ABCDEF'. -
text_outline_opacity(Optional[str]) –Text outline opacity from 0 (transparent) to 1 (opaque), e.g.
'0.5'. -
text_outline_width(Optional[str]) –Text outline/stroke width, e.g.
'1px'. -
text_valign(Union[str, TextVAlignLiteral, None]) –Vertical alignment of node or edge text, e.g.
'center','top', or'bottom'. -
text_wrap(Union[str, TextWrapLiteral, None]) –Text wrapping mode, e.g.
'wrap','ellipsis', or'none'. -
top(Optional[str]) –Node vertical position from the top edge, e.g.
'50px'. -
transition_property(Optional[str]) –CSS property to animate, e.g.
'background-color'. -
transition_duration(Optional[str]) –Animation duration, e.g.
'0.3s'. -
width(Optional[str]) –Node width, e.g.
'80px'. -
z_index(Optional[str]) –Stacking order of the node, e.g.
'10'.
background_color
class-attribute
instance-attribute
¶
Node background color as a plain string, e.g. 'red' or hex code, e.g. '#ABCDEF'.
background_opacity
class-attribute
instance-attribute
¶
Node background opacity from 0 (transparent) to 1 (opaque), e.g. '0.5'.
border
class-attribute
instance-attribute
¶
Shorthand for border-width border-style (required) border-color, e.g. 'solid' or '5px dotted blue'.
border_color
class-attribute
instance-attribute
¶
Node border color as a plain string, e.g. 'black' or hex code, e.g. '#ABCDEF'.
border_radius
class-attribute
instance-attribute
¶
Node border corner radius, e.g. '5px'.
border_style
class-attribute
instance-attribute
¶
Node border style, e.g. 'solid' or 'dashed'.
border_width
class-attribute
instance-attribute
¶
Node border width, e.g. '2px'.
box_shadow
class-attribute
instance-attribute
¶
Node box shadow effect, e.g. '2px 2px 5px #ABCDEF'.
color
class-attribute
instance-attribute
¶
Node text color as a plain string, e.g. 'red' or hex code, e.g. '#ABCDEF'.
curve_style
class-attribute
instance-attribute
¶
Style of edges curvature, e.g. 'bezier', 'unbundled-bezier', or 'source-target'.
font_family
class-attribute
instance-attribute
¶
Node or edge label font family, e.g. 'sans-serif' or 'monospace'.
font_size
class-attribute
instance-attribute
¶
Node or edge label text size, e.g. '14px'.
font_style
class-attribute
instance-attribute
¶
Node or edge label font style, e.g. 'italic', 'oblique', or 'normal'.
font_weight
class-attribute
instance-attribute
¶
Node or edge label font weight, e.g. 'normal', 'bold', 'bolder', 'lighter', or a number from 100 to 900.
label
class-attribute
instance-attribute
¶
Node or edge label as plain text.
left
class-attribute
instance-attribute
¶
Node horizontal position from the left edge, e.g. '100px'.
line_color
class-attribute
instance-attribute
¶
Edge color as a plain string, e.g. 'red' or hex code, e.g. '#ABCDEF'.
line_dash_pattern
class-attribute
instance-attribute
¶
Edge line dash pattern, e.g. '4,2' for dashed lines or '2,2' for dotted lines.
line_height
class-attribute
instance-attribute
¶
Line height multiplier for text, e.g. '1.2'.
line_style
class-attribute
instance-attribute
¶
Edge line style, e.g. 'solid', 'dashed', or 'dotted'.
line_width
class-attribute
instance-attribute
¶
Edge line width, e.g. '2px'.
max_width
class-attribute
instance-attribute
¶
Maximum node width, e.g. '200px'.
min_width
class-attribute
instance-attribute
¶
Minimum node width, e.g. '50px'.
padding
class-attribute
instance-attribute
¶
Node internal padding, e.g. '10px'.
padding_bottom
class-attribute
instance-attribute
¶
Node internal bottom padding, e.g. '10px'.
padding_left
class-attribute
instance-attribute
¶
Node internal left padding, e.g. '10px'.
padding_right
class-attribute
instance-attribute
¶
Node internal right padding, e.g. '10px'.
padding_top
class-attribute
instance-attribute
¶
Node internal top padding, e.g. '10px'.
position
class-attribute
instance-attribute
¶
Node position as coordinates, e.g. '{x: 100, y: 200}'.
shape
class-attribute
instance-attribute
¶
Node shape, e.g. 'rectangle', 'ellipse', 'circle', 'diamond', 'triangle', etc.
target_arrow_color
class-attribute
instance-attribute
¶
Edge arrow color as a plain string, e.g. 'red' or hex code, e.g. '#ABCDEF'.
target_arrow_shape
class-attribute
instance-attribute
¶
Edge arrow shape, e.g. 'triangle', 'vee', 'circle', 'diamond', 'none', etc.
text_background_color
class-attribute
instance-attribute
¶
Text background fill color, e.g. 'white' or hex code, '#ABCDEF'.
text_background_opacity
class-attribute
instance-attribute
¶
Text background opacity from 0 (transparent) to 1 (opaque), e.g. '0.5'.
text_background_padding
class-attribute
instance-attribute
¶
Padding around text background, e.g. '5px'.
text_halign
class-attribute
instance-attribute
¶
Horizontal alignment of node or edge text, e.g. 'center', 'left', or 'right'.
text_max_width
class-attribute
instance-attribute
¶
Maximum text width before wrapping, e.g. '150px'.
text_min_width
class-attribute
instance-attribute
¶
Minimum text width before wrapping, e.g. '150px'.
text_outline_color
class-attribute
instance-attribute
¶
Text outline/stroke color, e.g. 'white' or hex code, '#ABCDEF'.
text_outline_opacity
class-attribute
instance-attribute
¶
Text outline opacity from 0 (transparent) to 1 (opaque), e.g. '0.5'.
text_outline_width
class-attribute
instance-attribute
¶
Text outline/stroke width, e.g. '1px'.
text_valign
class-attribute
instance-attribute
¶
Vertical alignment of node or edge text, e.g. 'center', 'top', or 'bottom'.
text_wrap
class-attribute
instance-attribute
¶
Text wrapping mode, e.g. 'wrap', 'ellipsis', or 'none'.
top
class-attribute
instance-attribute
¶
Node vertical position from the top edge, e.g. '50px'.
transition_property
class-attribute
instance-attribute
¶
CSS property to animate, e.g. 'background-color'.
transition_duration
class-attribute
instance-attribute
¶
Animation duration, e.g. '0.3s'.
z_index
class-attribute
instance-attribute
¶
Stacking order of the node, e.g. '10'.
copy_
¶
Alias for self.model_copy(update).
Copies the current object and updates values in the new object as specified in the given dictionary.
Parameters:
-
(update¶Optional[Dict[str, Optional[str]]], default:None) –An update dictionary with values to set in the new object. Entries with
Noneas value are also valid, since this will reset the parameter to its default value. If None, the object is copied and left as-is. Defaults to None.
Returns:
-
Self(Self) –A copy of this object, with value changes if specified in the
updatedictionary.
merge
¶
Merges the current object together with another FormatDefinition object into a new object.
None values in both objects are ignored (i.e. remain as None).
The values from the other object take precedence over the current object.
Both original objects remain unchanged, and a new object with the merged properties is returned.
Parameters:
Returns:
-
Self(Self) –A new FormatDefinition object that combines the properties of both objects.
Formats
¶
Bases: BaseModel
Methods:
-
add_format–Adds a format with the given name and the provided format definition.
-
remove_format–Removes a format with the given name from the definitions.
-
format_nodes–Formats the specified nodes with the given format.
add_format
¶
add_format(name: FormatName, format: FormatDefinition) -> FormatDefinition
Adds a format with the given name and the provided format definition.
If the format name starts with a period (.), ipycytoscape will treat it like a CSS class.
Parameters:
-
(name¶FormatName) –The name of the format. If the format name starts with a period (.), ipycytoscape will treat it like a CSS class.
-
(format¶FormatDefinition) –The format definition associated with the given name.
Raises:
-
IdentifierConflictError–If the given name is already used for a format definition.
Returns:
-
FormatDefinition(FormatDefinition) –The given format definition.
remove_format
¶
remove_format(format: FormatName) -> None
Removes a format with the given name from the definitions.
Parameters:
-
(format¶FormatName) –The name of the format to remove.
Raises:
-
ObjectNotFoundError–If the given format name does not exist.
format_nodes
¶
format_nodes(
nodes: Union[NodeName, Iterable[NodeName]],
format: FormatName,
append: bool = True,
) -> None
Formats the specified nodes with the given format.
If append is True, the format is added to the existing formats for each node.
If False, it overwrites any existing formats, so that the specified nodes only have the given format afterwards.
Parameters: