Image and background attributes¶
-
class img_gen.Background(image: str =
None, color: ColorKind =None, preserve_aspect: PreserveAspect =None)¶ –
An attribute to describe a [
Layer](struct@crate::Layer)’sbackground.- as_json_str()¶
Serialize the
Backgroundobject to a JSON string.
- as_yaml_str()¶
Serialize the
Backgroundobject to a YAML string.
- color¶
A color overlaid on top of the
image. If no image is specified, then the layer is simple filled with this color.
- static from_json_str(json_str)¶
Deserialize a
Backgroundobject from a JSON string.
- static from_yaml_str(yaml_str)¶
Deserialize a
Backgroundobject from a YAML string.
- image¶
A path to an image file.
If the given image path has no file extension, then it will be treated as an SVG image.
This also supports built-in SVG icons from the following icon packs:
Material Design Icons (
material/{icon_slug})Simple Icons (
simple/{icon_slug})Octicons (
octicons/{icon_slug})FontAwesome Free (
fontawesome/<brands|solid|regular>/{icon_slug})
Otherwise, the image file’s path is resolved via a search through the list of
external_resource_pathsprovided to theGenerator(inimg_gen_renderercrate), which defaults to the current working directory if unspecified or an empty list.
- preserve_aspect¶
This controls how the original image is rendered into the layer. Default is to preserve the original image’s width and height.
-
class img_gen.Icon(image: str, color: ColorKind =
None, preserve_aspect: PreserveAspect | None =None)¶ –
An attribute to describe a [
Layer](struct@crate::Layer)’s [Icon].- color¶
A color used to replace the [
Icon::image]’s original coloring.
- image¶
A path to an image file.
If the given image path has no file extension, then it will be treated as an SVG image.
This also supports built-in SVG icons from the following icon packs:
Material Design Icons (
material/{icon_slug})Simple Icons (
simple/{icon_slug})Octicons (
octicons/{icon_slug})FontAwesome Free (
fontawesome/<brands|solid|regular>/{icon_slug})
Otherwise, the image file’s path is resolved via a search through the list of
external_resource_pathsprovided to theGenerator(inimg_gen_renderercrate), which defaults to the current working directory if unspecified or an empty list.
- preserve_aspect¶
This controls how the original image is rendered into the layer.
The default is to preserve the original image’s width and height ([
PreserveAspect::On]).