Skip to content

Traits

Useful traits for SVG elements.

Traits are mixins that are used to add common functionality to SVG elements.

For example, we want to be able to normalize the pathLength attribute of all shapes in SVG. Therefore, the Shape trait contains the set_path_length method. Elements that are shapes inherit from the Shape trait and therefore automatically have the set_path_length method.

This approach allows us to define common functionality in one place and reuse it on different elements.

Most traits are defined based on the "1.6 Definitions" section of the SVG 1.1 specification.

AnimationElement

Bases: AnimationEventsAttrs, AnimationTimingAttrs, Element

An animation element.

From the SVG 1.1 specification:

"An animation element is an element that can be used to animate the attribute or property value of another element."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • restart (Literal[always, whenNotActive, never] | None, default: None ) –
  • repeatDur (Literal[indefinite] | str | None, default: None ) –
  • repeatCount (Literal[indefinite] | Annotated[float, AllowInfNan] | None, default: None ) –
  • min (Literal[media] | str | None, default: None ) –
  • max (Literal[media] | str | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • end (str | None, default: None ) –
  • dur (str | Literal[media, indefinite] | None, default: None ) –
  • begin (str | None, default: None ) –
  • onrepeat (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onend (str | None, default: None ) –
  • onbegin (str | None, default: None ) –
Source code in svglab/elements/traits.py
class AnimationElement(
    attrgroups.AnimationEventsAttrs,
    attrgroups.AnimationTimingAttrs,
    Element,
):
    """An animation element.

    From the SVG 1.1 specification:
    > "An animation element is an element that can be used to animate the
    attribute or property value of another element."
    """

BasicShape

Bases: Shape

A basic shape.

From the SVG 1.1 specification:

"Standard shapes which are predefined in SVG as a convenience for common graphical operations."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • onmouseup (str | None, default: None ) –
  • onmouseover (str | None, default: None ) –
  • onmouseout (str | None, default: None ) –
  • onmousemove (str | None, default: None ) –
  • onmousedown (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onfocusout (str | None, default: None ) –
  • onfocusin (str | None, default: None ) –
  • onclick (str | None, default: None ) –
  • onactivate (str | None, default: None ) –
  • pathLength (Annotated[float, AllowInfNan] | None, default: None ) –
Source code in svglab/elements/traits.py
class BasicShape(Shape, metaclass=abc.ABCMeta):
    """A basic shape.

    From the SVG 1.1 specification:
    > "Standard shapes which are predefined in SVG as a convenience for common
    graphical operations."
    """

    @abc.abstractmethod
    def to_path_data(self) -> path_data.PathData:
        """Convert this basic shape into path data.

        The resulting path data produce the same visual result as the original
        basic shape.

        Returns:
            A `PathData` instance representing the path data.

        """
        ...

    @abc.abstractmethod
    def to_path(self) -> _PathLike:
        """Convert this basic shape into a `Path` element.

        The resulting `Path` element's path data produce the same visual result
        as the original basic shape. The `Path` element will have the same
        attributes as the original basic shape.

        Returns:
            A `Path` element representing the basic shape.

        """
        ...

to_path abstractmethod

to_path() -> _PathLike

Convert this basic shape into a Path element.

The resulting Path element's path data produce the same visual result as the original basic shape. The Path element will have the same attributes as the original basic shape.

Returns:

  • _PathLike

    A Path element representing the basic shape.

Source code in svglab/elements/traits.py
@abc.abstractmethod
def to_path(self) -> _PathLike:
    """Convert this basic shape into a `Path` element.

    The resulting `Path` element's path data produce the same visual result
    as the original basic shape. The `Path` element will have the same
    attributes as the original basic shape.

    Returns:
        A `Path` element representing the basic shape.

    """
    ...

to_path_data abstractmethod

to_path_data() -> PathData

Convert this basic shape into path data.

The resulting path data produce the same visual result as the original basic shape.

Returns:

  • PathData

    A PathData instance representing the path data.

Source code in svglab/elements/traits.py
@abc.abstractmethod
def to_path_data(self) -> path_data.PathData:
    """Convert this basic shape into path data.

    The resulting path data produce the same visual result as the original
    basic shape.

    Returns:
        A `PathData` instance representing the path data.

    """
    ...

ContainerElement

Bases: _GraphicalOperations, GraphicalEventsAttrs, Element

A container element.

From the SVG 1.1 specification:

"An element which can have graphics elements and other container elements as child elements."

Parameters:

  • onmouseup (str | None, default: None ) –
  • onmouseover (str | None, default: None ) –
  • onmouseout (str | None, default: None ) –
  • onmousemove (str | None, default: None ) –
  • onmousedown (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onfocusout (str | None, default: None ) –
  • onfocusin (str | None, default: None ) –
  • onclick (str | None, default: None ) –
  • onactivate (str | None, default: None ) –
  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class ContainerElement(
    _GraphicalOperations, attrgroups.GraphicalEventsAttrs, Element
):
    """A container element.

    From the SVG 1.1 specification:
    > "An element which can have graphics elements and other container elements
    as child elements."
    """

DescriptiveElement

Bases: Element

A descriptive element.

From the SVG 1.1 specification:

"An element which provides supplementary descriptive information about its parent."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class DescriptiveElement(Element):
    """A descriptive element.

    From the SVG 1.1 specification:
    > "An element which provides supplementary descriptive information about
    its parent."
    """

Element

Bases: Element

An SVG element.

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class Element(entities.Element):
    """An SVG element."""

FilterPrimitiveElement

Bases: FilterPrimitivesAttrs, Element

A filter primitive element.

From the SVG 1.1 specification:

"A filter primitive element is one that can be used as a child of a filter element to specify a node in the filter graph."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • result (str | None, default: None ) –
  • height (Annotated[Length, BeforeValidator] | None, default: None ) –
  • width (Annotated[Length, BeforeValidator] | None, default: None ) –
  • y (Annotated[Length, BeforeValidator] | None, default: None ) –
  • x (Annotated[Length, BeforeValidator] | None, default: None ) –
Source code in svglab/elements/traits.py
class FilterPrimitiveElement(attrgroups.FilterPrimitivesAttrs, Element):
    """A filter primitive element.

    From the SVG 1.1 specification:
    > "A filter primitive element is one that can be used as a child of
    a `filter` element to specify a node in the filter graph."
    """

GradientElement

Bases: Element

A gradient element.

From the SVG 1.1 specification:

"A gradient element is one that defines a gradient paint server."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class GradientElement(Element):
    """A gradient element.

    From the SVG 1.1 specification:
    > "A gradient element is one that defines a gradient paint server."
    """

GraphicsElement

Bases: _GraphicalOperations, GraphicalEventsAttrs, StrokeWidthScaled, Element

A graphics element.

From the SVG 1.1 specification:

"One of the element types that can cause graphics to be drawn onto the target canvas."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • onmouseup (str | None, default: None ) –
  • onmouseover (str | None, default: None ) –
  • onmouseout (str | None, default: None ) –
  • onmousemove (str | None, default: None ) –
  • onmousedown (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onfocusout (str | None, default: None ) –
  • onfocusin (str | None, default: None ) –
  • onclick (str | None, default: None ) –
  • onactivate (str | None, default: None ) –
Source code in svglab/elements/traits.py
class GraphicsElement(
    _GraphicalOperations,
    attrgroups.GraphicalEventsAttrs,
    entities.StrokeWidthScaled,
    Element,
):
    """A graphics element.

    From the SVG 1.1 specification:
    > "One of the element types that can cause graphics to be drawn onto the
    target canvas."
    """

GraphicsReferencingElement

Bases: Element

A graphics referencing element.

From the SVG 1.1 specification:

"A graphics element which uses a reference to a different document or element as the source of its graphical content."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class GraphicsReferencingElement(Element):
    """A graphics referencing element.

    From the SVG 1.1 specification:
    > "A graphics element which uses a reference to a different document or
    element as the source of its graphical content."
    """

LightSourceElement

Bases: Element

A light source element.

From the SVG 1.1 specification:

"A light source element is one that can specify light source information for an feDiffuseLighting or feSpecularLighting element."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class LightSourceElement(Element):
    """A light source element.

    From the SVG 1.1 specification:
    > "A light source element is one that can specify light source information
    for an `feDiffuseLighting` or `feSpecularLighting` element."
    """

Shape

Bases: PathLengthAttr, GraphicsElement

A shape.

From the SVG 1.1 specification:

"A graphics element that is defined by some combination of straight lines and curves."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • onmouseup (str | None, default: None ) –
  • onmouseover (str | None, default: None ) –
  • onmouseout (str | None, default: None ) –
  • onmousemove (str | None, default: None ) –
  • onmousedown (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onfocusout (str | None, default: None ) –
  • onfocusin (str | None, default: None ) –
  • onclick (str | None, default: None ) –
  • onactivate (str | None, default: None ) –
  • pathLength (Annotated[float, AllowInfNan] | None, default: None ) –
Source code in svglab/elements/traits.py
class Shape(attrdefs.PathLengthAttr, GraphicsElement):
    """A shape.

    From the SVG 1.1 specification:
    > "A graphics element that is defined by some combination of straight lines
    and curves."
    """

    def set_path_length(self, value: float) -> None:
        """Set a new value for the `pathLength` attribute.

        This method sets a new value for the `pathLength` attribute and scales
        the shape's `stroke-dasharray` and `stroke-dashoffset` attributes
        so that the visual appearance of the shape remains unchanged.

        The shape must have the `pathLength` attribute defined. The `Length`
        values of the scaled attributes must be either in percentages (`%`) or
        convertible to user units. Percentage values are not scaled.

        Args:
            value: The new value for the `pathLength` attribute. Must be
                positive.

        Raises:
            ValueError: If the `value` is not positive.
            RuntimeError: If the current path length is `None`.
            SvgUnitConversionError: If the attribute values cannot be converted
                to user units.

        """
        if value <= 0:
            raise ValueError("Path length must be positive")

        if self.pathLength is None:
            raise RuntimeError("Current pathLength must not be None")

        ratio = value / self.pathLength
        entities.scale_distance_along_a_path_attrs(self, ratio)

        self.pathLength = value

set_path_length

set_path_length(value: float) -> None

Set a new value for the pathLength attribute.

This method sets a new value for the pathLength attribute and scales the shape's stroke-dasharray and stroke-dashoffset attributes so that the visual appearance of the shape remains unchanged.

The shape must have the pathLength attribute defined. The Length values of the scaled attributes must be either in percentages (%) or convertible to user units. Percentage values are not scaled.

Parameters:

  • value (float) –

    The new value for the pathLength attribute. Must be positive.

Raises:

  • ValueError

    If the value is not positive.

  • RuntimeError

    If the current path length is None.

  • SvgUnitConversionError

    If the attribute values cannot be converted to user units.

Source code in svglab/elements/traits.py
def set_path_length(self, value: float) -> None:
    """Set a new value for the `pathLength` attribute.

    This method sets a new value for the `pathLength` attribute and scales
    the shape's `stroke-dasharray` and `stroke-dashoffset` attributes
    so that the visual appearance of the shape remains unchanged.

    The shape must have the `pathLength` attribute defined. The `Length`
    values of the scaled attributes must be either in percentages (`%`) or
    convertible to user units. Percentage values are not scaled.

    Args:
        value: The new value for the `pathLength` attribute. Must be
            positive.

    Raises:
        ValueError: If the `value` is not positive.
        RuntimeError: If the current path length is `None`.
        SvgUnitConversionError: If the attribute values cannot be converted
            to user units.

    """
    if value <= 0:
        raise ValueError("Path length must be positive")

    if self.pathLength is None:
        raise RuntimeError("Current pathLength must not be None")

    ratio = value / self.pathLength
    entities.scale_distance_along_a_path_attrs(self, ratio)

    self.pathLength = value

StructuralElement

Bases: Element

A structural element.

From the SVG 1.1 specification:

"The structural elements are those which define the primary structure of an SVG document."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class StructuralElement(Element):
    """A structural element.

    From the SVG 1.1 specification:
    > "The structural elements are those which define the primary structure of
    an SVG document."
    """

TextContentBlockElement

Bases: Element

A text content block element.

From the SVG 1.1 specification:

"A text content block element is a text content element that serves as a standalone element for a unit of text, and which may optionally contain certain child text content elements (e.g. tspan)."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class TextContentBlockElement(Element):
    """A text content block element.

    From the SVG 1.1 specification:
    > "A text content block element is a text content element that serves as a
    standalone element for a unit of text, and which may optionally contain
    certain child text content elements (e.g. `tspan`)."
    """

TextContentChildElement

Bases: Element

A text content child element.

From the SVG 1.1 specification:

"A text content child element is a text content element that is allowed as a descendant of another text content element."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
Source code in svglab/elements/traits.py
class TextContentChildElement(Element):
    """A text content child element.

    From the SVG 1.1 specification:
    > "A text content child element is a text content element that is allowed
    as a descendant of another text content element."
    """

TextContentElement

Bases: GraphicsElement

A text content element.

From the SVG 1.1 specification:

"A text content element is an SVG element that causes a text string to be rendered onto the canvas."

Parameters:

  • writing_mode (Literal[lr - tb, rl - tb, tb - rl, lr, rl, tb] | Literal[inherit] | None, default: None ) –
  • word_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • white_space (Literal[normal, pre, nowrap, pre - wrap, 'break-spaces', pre - line] | Literal[inherit] | None, default: None ) –
  • visibility (Literal[visible, hidden, collapse] | Literal[inherit] | None, default: None ) –
  • vector_effect (Literal[non - scaling - stroke, non - scaling - size, non - rotation, fixed - position] | Literal[none] | None, default: None ) –
  • unicode_bidi (Literal[normal, embed, bidi - override] | Literal[inherit] | None, default: None ) –
  • transform_origin (Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator]], BeforeValidator] | Annotated[tuple[Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Literal[left, center, right, top, bottom] | Annotated[Length, BeforeValidator], Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • transform (Annotated[list[Translate | Scale | Rotate | SkewX | SkewY | Matrix], BeforeValidator] | None, default: None ) –
  • text_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeLegibility, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • text_indent (Annotated[Length, BeforeValidator] | Literal[each - line, hanging] | Literal[inherit] | None, default: None ) –
  • text_decoration (Literal[none] | Literal[underline, overline, line - through, blink] | Literal[inherit] | None, default: None ) –
  • text_anchor (Literal[start, middle, end] | Literal[inherit] | None, default: None ) –
  • text_align_last (Literal[auto] | Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • text_align (Literal[start, end, left, right, center, justify, match - parent, justify - all] | Literal[inherit] | None, default: None ) –
  • text_align_all (Literal[start, end, left, right, center, justify, match - parent] | Literal[inherit] | None, default: None ) –
  • stroke_width (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stroke_miterlimit (Annotated[float, AllowInfNan, FieldInfo] | Literal[inherit] | None, default: None ) –
  • stroke_linejoin (Literal[miter, round, bevel, miter - clip, arcs] | Literal[inherit] | None, default: None ) –
  • stroke_linecap (Literal[butt, round, square] | Literal[inherit] | None, default: None ) –
  • stroke_dashoffset (Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke_dasharray (Literal[none] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • stroke (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | None, default: None ) –
  • stop_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • stop_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • shape_rendering (Literal[auto] | Literal[optimizeSpeed, crispEdges, geometricPrecision] | Literal[inherit] | None, default: None ) –
  • pointer_events (Literal[visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke] | Literal[all] | Literal[none] | Literal[inherit] | None, default: None ) –
  • paint_order (Literal[normal, fill, stroke, markers] | None | Literal[inherit], default: None ) –
  • overflow (Literal[visible, hidden, scroll] | Literal[auto] | Literal[inherit] | None, default: None ) –
  • opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • mask (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_start (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_mid (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • marker_end (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • lighting_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • letter_spacing (Literal[normal] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • kerning (Literal[auto] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • image_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_vertical (Literal[auto] | Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • glyph_orientation_horizontal (Annotated[Angle, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_weight (Literal[all] | Literal[inherit] | Annotated[list[Literal[normal, bold, bolder, lighter] | Annotated[Literal[100, 200, 300, 400, 500, 600, 700, 800, 900], BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_variant (Literal[normal, small - caps] | Literal[inherit] | None, default: None ) –
  • font_style (Literal[all] | Annotated[list[Literal[normal, italic, oblique]], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • font_stretch (Literal[all] | Literal[condensed, condensed, expanded, extra - condensed, extra - expanded, narrower, normal, semi - condensed, semi - expanded, ultra - condensed, ultra - expanded, wider] | Literal[inherit] | None, default: None ) –
  • font_size (Literal[xx - small, x - small, small, medium, large, x - large, xx - large] | Literal[smaller, larger] | Annotated[Length, BeforeValidator] | Literal[inherit] | Literal[all] | Annotated[list[Annotated[Length, BeforeValidator]], BeforeValidator] | None, default: None ) –
  • font_size_adjust (Annotated[float, AllowInfNan] | Literal[none] | Literal[inherit] | None, default: None ) –
  • font_family (Annotated[list[str], BeforeValidator] | Literal[inherit] | None, default: None ) –
  • flood_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • flood_color (Literal[currentColor] | Literal[inherit] | str | Color | None, default: None ) –
  • filter (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • fill_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • fill_opacity (Annotated[float, AllowInfNan, AfterValidator] | Literal[inherit] | None, default: None ) –
  • fill (Literal[none] | Literal[currentColor, context - fill, context - stroke] | Literal[inherit] | Color | Annotated[FuncIri, BeforeValidator] | Literal[freeze, remove] | None, default: None ) –
  • enable_background (Literal[accumulate] | Literal[inherit] | str | None, default: None ) –
  • dominant_baseline (Literal[auto] | Literal[use - script, no - change, reset - size, ideographic, alphabetic, hanging, mathematical, central, middle, text - after - edge, text - before - edge] | Literal[inherit] | None, default: None ) –
  • display (Literal[block, compact, inline - table, inline, list - item, marker, 'run-in', table - caption, table - cell, table - column - group, table - column, table - footer - group, table - header - group, table - row - group, table - row, table] | Literal[none] | Literal[inherit] | None, default: None ) –
  • direction (Literal[ltr, rtl] | Literal[inherit] | None, default: None ) –
  • cursor (Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help] | Literal[inherit] | Annotated[list[Annotated[FuncIri, BeforeValidator] | Literal[auto] | Literal[crosshair, default, pointer, move, e - resize, ne - resize, nw - resize, n - resize, se - resize, sw - resize, s - resize, w - resize, text, wait, help]], BeforeValidator] | None, default: None ) –
  • color_rendering (Literal[auto] | Literal[optimizeSpeed, optimizeQuality] | Literal[inherit] | None, default: None ) –
  • color_profile (Literal[auto] | Literal[sRGB] | str | Annotated[Iri, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • color_interpolation_filters (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color_interpolation (Literal[auto] | Literal[sRGB, linearRGB] | Literal[inherit] | None, default: None ) –
  • color (Literal[currentColor] | Literal[inherit] | Color | None, default: None ) –
  • clip_rule (Literal[nonzero, evenodd] | Literal[inherit] | None, default: None ) –
  • clip_path (Annotated[FuncIri, BeforeValidator] | Literal[none] | Literal[inherit] | None, default: None ) –
  • clip (str | Literal[auto] | Literal[inherit] | None, default: None ) –
  • baseline_shift (Literal[baseline, sub, super] | Annotated[Length, BeforeValidator] | Literal[inherit] | None, default: None ) –
  • alignment_baseline (Literal[auto] | Literal[inherit] | Literal[baseline, before - edge, text - before - edge, middle, central, after - edge, text - after - edge, ideographic, alphabetic, hanging, mathematical] | None, default: None ) –
  • xml_space (Literal[default, preserve] | None, default: None ) –
  • xml_lang (str | None, default: None ) –
  • xml_base (Annotated[Iri, BeforeValidator] | None, default: None ) –
  • lang (str | None, default: None ) –
  • id (str | None, default: None ) –
  • parent (Element | None, default: None ) –
  • prefix (str | None, default: None ) –
  • onmouseup (str | None, default: None ) –
  • onmouseover (str | None, default: None ) –
  • onmouseout (str | None, default: None ) –
  • onmousemove (str | None, default: None ) –
  • onmousedown (str | None, default: None ) –
  • onload (str | None, default: None ) –
  • onfocusout (str | None, default: None ) –
  • onfocusin (str | None, default: None ) –
  • onclick (str | None, default: None ) –
  • onactivate (str | None, default: None ) –
Source code in svglab/elements/traits.py
class TextContentElement(GraphicsElement):
    """A text content element.

    From the SVG 1.1 specification:
    > "A text content element is an SVG element that causes a text string to be
    rendered onto the canvas."
    """