You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/image.rst
+26-18Lines changed: 26 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,14 +83,39 @@ Configuration variables:
83
83
additionally need to have the python ``cairosvg`` package installed. These are automatically installed when
84
84
setting up ESPHome via the usual methods.
85
85
86
+
87
+
Setting defaults
88
+
----------------
89
+
90
+
For the situation where most or all of your images share common attributes, you can use another schema style to provide default values. In this case
91
+
the ``defaults:`` option will provide fallback values for all images. When using this format the ``images:`` key takes a list of image definitions.
92
+
93
+
.. code-block:: yaml
94
+
95
+
image:
96
+
defaults:
97
+
type: rgb565
98
+
transparency: opaque
99
+
resize: 100x100
100
+
images:
101
+
- file: "image1.png"
102
+
id: image1
103
+
- file: "image2.png"
104
+
id: image2
105
+
resize: 200x200# overrides the default resize
106
+
86
107
Grouping images by type
87
108
-----------------------
88
109
89
-
You can group images by type to make it easier to manage them. This is useful when you have a lot of images to be encoded in the same way, and avoids having to repeat the same type for each image. The type name is used as the key for the group. For example:
110
+
You can group images by type to make it easier to manage them. This is useful when you have a lot of images to be encoded in the same way,
111
+
and avoids having to repeat the same type for each image. A ``defaults:`` group can be used to specify default values other than the type.
112
+
The type name is used as the key for the group. For example:
90
113
91
114
.. code-block:: yaml
92
115
93
116
image:
117
+
defaults:
118
+
resize: 100x100
94
119
grayscale:
95
120
- file: "image1.png"
96
121
id: image1
@@ -119,23 +144,6 @@ In addition, the default transparency type can be set within a type group by usi
119
144
opaque:
120
145
- file: "image2.png"
121
146
122
-
For the situation where most or all of your images share common attributes, you can use another schema style to provide default values. In this case
123
-
the ``defaults:`` option will provide fallback values for all images. When using this format the ``images:`` key takes only a list of image definitions.
0 commit comments