MkIcon
Pyconify-based Icon.¶
Example: With caption¶
Example: Colored¶
Example: Rotated¶
Example: Sized¶
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 128 128"><path fill="#82AEC0" d="M113.88 94.05c-1.36-1.16-3.17-2.53-5.46-4.26c-8.49-6.44-24.2-18.37-50.96-45.03c2.06-3.75 3.23-7.95 3.36-12.37c.24-7.56-2.69-14.97-8.04-20.32c-8.84-8.84-22.55-10.61-33.34-4.3c-.49.29-.79.82-.79 1.39s.31 1.1.8 1.38l16.61 9.59c1.64 8.29-3.12 16.57-11.18 19.35L8.22 29.84c-.49-.28-1.1-.29-1.59 0c-.49.28-.8.8-.81 1.37c-.09 8.13 3.4 15.85 9.58 21.18c5.12 4.42 11.52 6.62 17.92 6.62c3.59 0 7.17-.72 10.54-2.11c24.21 24.32 35.66 41.18 42.52 51.29c2.4 3.54 4.14 6.1 5.63 7.77c4.56 5.1 9.52 7.86 14.36 7.99c.12 0 5.33.8 10.83-4.7c3.46-3.46 5.14-7.25 4.98-11.24c-.2-4.74-2.99-9.44-8.3-13.96m-9.07 18.92c-3.39 0-6.15-2.75-6.15-6.15s2.75-6.15 6.15-6.15s6.15 2.75 6.15 6.15s-2.76 6.15-6.15 6.15"/><path fill="#2F7889" d="M61.13 48.38c-1.2-1.18-2.42-2.39-3.67-3.63c2.06-3.75 3.23-7.95 3.36-12.37c.09-3-.32-5.96-1.17-8.79c-.76-1.25-1.96-2.59-2.72-1.78c.31 9.82-2.54 20.05-9.37 27.11c-3.39 3.5-7.8 6.03-12.53 7.23c-2.34.59-4.76.85-7.17.72c-1.41-.08-5.39-1.55-6.19-.47v.05c3.67 1.71 7.65 2.56 11.63 2.56c3.59 0 7.17-.72 10.54-2.11c7.83 7.87 14.32 14.95 19.76 21.28c-2.72-5.14-10.74-14.63-12.88-18.25c-.48-.82-1.16-2.92.37-4.81c2.17-2.65 6.58-5.11 10.04-6.74"/><path fill="#B9E4EA" d="M70.01 66.91s3.73-1.64 9.25 2.83c5.52 4.48 26.76 22.54 28.55 24.93s-5.42-.04-7.96-.48c-2.53-.45-29.84-27.28-29.84-27.28M43.32 12c3.08 2.21 5.84 4.82 8.73 7.28c.74.63 1.83 1.27 2.6.66c.83-.66.31-1.98-.32-2.84c-5.46-7.5-15.65-12.86-25.5-10.73C34.03 8.04 38.7 8.7 43.32 12"/><path fill="#2F7889" d="M18.83 37.74c1.21.72 2.89 1.7 3.86 1.97c1.17.32 4.46-.95 5.42-1.72c-3.94-2.57-8.34-5.45-12.29-8.02c-.45-.29-.9-.59-1.41-.75c-.62-.19-1.28-.18-1.92-.14c-.9.04-5.3-.11-5.81.67c-.52.79 1.31 1.54 1.9 1.9c3.41 2.04 6.84 4.05 10.25 6.09"/></svg>
<p><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 128 128"><path fill="#82AEC0" d="M113.88 94.05c-1.36-1.16-3.17-2.53-5.46-4.26c-8.49-6.44-24.2-18.37-50.96-45.03c2.06-3.75 3.23-7.95 3.36-12.37c.24-7.56-2.69-14.97-8.04-20.32c-8.84-8.84-22.55-10.61-33.34-4.3c-.49.29-.79.82-.79 1.39s.31 1.1.8 1.38l16.61 9.59c1.64 8.29-3.12 16.57-11.18 19.35L8.22 29.84c-.49-.28-1.1-.29-1.59 0c-.49.28-.8.8-.81 1.37c-.09 8.13 3.4 15.85 9.58 21.18c5.12 4.42 11.52 6.62 17.92 6.62c3.59 0 7.17-.72 10.54-2.11c24.21 24.32 35.66 41.18 42.52 51.29c2.4 3.54 4.14 6.1 5.63 7.77c4.56 5.1 9.52 7.86 14.36 7.99c.12 0 5.33.8 10.83-4.7c3.46-3.46 5.14-7.25 4.98-11.24c-.2-4.74-2.99-9.44-8.3-13.96m-9.07 18.92c-3.39 0-6.15-2.75-6.15-6.15s2.75-6.15 6.15-6.15s6.15 2.75 6.15 6.15s-2.76 6.15-6.15 6.15"/><path fill="#2F7889" d="M61.13 48.38c-1.2-1.18-2.42-2.39-3.67-3.63c2.06-3.75 3.23-7.95 3.36-12.37c.09-3-.32-5.96-1.17-8.79c-.76-1.25-1.96-2.59-2.72-1.78c.31 9.82-2.54 20.05-9.37 27.11c-3.39 3.5-7.8 6.03-12.53 7.23c-2.34.59-4.76.85-7.17.72c-1.41-.08-5.39-1.55-6.19-.47v.05c3.67 1.71 7.65 2.56 11.63 2.56c3.59 0 7.17-.72 10.54-2.11c7.83 7.87 14.32 14.95 19.76 21.28c-2.72-5.14-10.74-14.63-12.88-18.25c-.48-.82-1.16-2.92.37-4.81c2.17-2.65 6.58-5.11 10.04-6.74"/><path fill="#B9E4EA" d="M70.01 66.91s3.73-1.64 9.25 2.83c5.52 4.48 26.76 22.54 28.55 24.93s-5.42-.04-7.96-.48c-2.53-.45-29.84-27.28-29.84-27.28M43.32 12c3.08 2.21 5.84 4.82 8.73 7.28c.74.63 1.83 1.27 2.6.66c.83-.66.31-1.98-.32-2.84c-5.46-7.5-15.65-12.86-25.5-10.73C34.03 8.04 38.7 8.7 43.32 12"/><path fill="#2F7889" d="M18.83 37.74c1.21.72 2.89 1.7 3.86 1.97c1.17.32 4.46-.95 5.42-1.72c-3.94-2.57-8.34-5.45-12.29-8.02c-.45-.29-.9-.59-1.41-.75c-.62-.19-1.28-.18-1.92-.14c-.9.04-5.3-.11-5.81.67c-.52.79 1.31 1.54 1.9 1.9c3.41 2.04 6.84 4.05 10.25 6.09"/></svg></p>
Bases: MkNode
__init__
¶
__init__(
icon_name: str,
*,
color: str | None = None,
height: str | int | None = None,
width: str | int | None = None,
flip: Flip | None = None,
rotate: Rotation | None = None,
box: bool | None = None,
**kwargs: Any
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon_name
|
str
|
Icon name |
required |
color
|
str | None
|
Icon color. Replaces currentColor with specific color, resulting in icon with hardcoded palette. |
None
|
height
|
str | int | None
|
Icon height. If only one dimension is specified, such as height, other dimension will be automatically set to match it. |
None
|
width
|
str | int | None
|
Icon width. If only one dimension is specified, such as height, other dimension will be automatically set to match it. |
None
|
flip
|
Flip | None
|
Flip icon. |
None
|
rotate
|
Rotation | None
|
Rotate icon. If an int is provided, it is assumed to be in degrees. |
None
|
box
|
bool | None
|
Adds an empty rectangle to SVG that matches the icon's viewBox. It is needed when importing SVG to various UI design tools that ignore viewBox. Those tools, such as Sketch, create layer groups that automatically resize to fit content. Icons usually have empty pixels around icon, so such software crops those empty pixels and icon's group ends up being smaller than actual icon, making it harder to align it in design. |
None
|
kwargs
|
Any
|
Keyword arguments passed to parent |
{}
|
Name | Children | Inherits |
---|---|---|
MkNode mknodes.basenodes.mknode Base class for everything which can be expressed as Markup. |
graph TD
94721306032672["mkicon.MkIcon"]
94721308848336["mknode.MkNode"]
94721311766592["node.Node"]
140564252373184["builtins.object"]
94721308848336 --> 94721306032672
94721311766592 --> 94721308848336
140564252373184 --> 94721311766592
[metadata]
icon = "mdi:image"
status = "new"
name = "MkIcon"
group = "image"
[examples.with_caption]
title = "With caption"
jinja = """
{{ "mdi:file" | MkIcon }}
"""
[examples.colored]
title = "Colored"
jinja = """
{{ "mdi:file" | MkIcon(color="red") }}
"""
[examples.rotated]
title = "Rotated"
jinja = """
{{ "mdi:file" | MkIcon(rotate=90) }}
"""
[examples.sized]
title = "Sized"
jinja = """
{{ "noto:wrench" | MkIcon(height=100, width=100) }}
"""
[output.html]
template = """
{{ node.icon_name | get_icon_svg(color=node.color, height=node.height, width=node.width, flip=node.flip, rotate=node.rotate, box=node.box)}}
"""