The Text tool¶
1.0.0 · Output · WIP
The Text tool is based on the SVG basic <text>
element shape.
Basic usage¶
The Text tool needs a center position, and - of course - some text to display.
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 9 |
|
Always use a relative font-size: it fits well with the relative sizes used by SAK
Unless you need a fixed size in pixels...
Styling¶
The Text tool has support for the following forms of styling:
Method | Support | Description |
---|---|---|
classes | Using SAK or User defined class definitions | |
styles | Using inline SVG and CSS styles |
The Text tool is composed of a single object: "text" and this is the selector for styling:
1 2 3 4 5 6 7 8 9 10 11 |
|
Property | Does what? | Example |
---|---|---|
font-size | Font size | font-size: 12em sets RELATIVE font size |
text-anchor | Anchor of text | text-anchor: start or middle , or end |
fill | Fill color | fill: red sets fill to color red |
stroke-width | Stroke width | stroke-width: 2em sets width to relative width of 2em |
stroke | Stroke color | stroke: blue sets stroke to blue |
opacity | Opacity (stroke/fill) | opacity: 0.7 sets the opacity of text to 70% |
fill-opacity | Opacity for fill | fill-opacity: 0.5 sets the fill opacity to 50% |
stroke-opacity | Opacity for stroke | stroke-opacity: 0.5 sets the stroke opacity to 50% |
Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text
Haptics¶
See: https://companion.home-assistant.io/docs/integrations/haptics/ for devices that support haptics
The tool supports haptic feedback through user_actions
/ tap_action
definition
Action | Haptic | Description |
---|---|---|
Click | haptic | Uses the haptic property defined in the user_actions definition of the tool. If not specified, a default of medium is used |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Possible values for haptic feedback:
Haptic | Description |
---|---|
success | Indicates that a task or action has completed. |
warning | Indicates that a task or action has produced a warning of some kind. |
failure | Indicates that a task or action has failed. |
light | Provides a physical metaphor that complements the visual experience. |
medium | Provides a physical metaphor that complements the visual experience. |
heavy | Provides a physical metaphor that complements the visual experience. |
selection | Indicates that the selection is actively changing. |
Animations¶
The Text tool has support for the following forms of animations:
Method | Support | Description |
---|---|---|
colorstops | List of state values to set the color | |
colorlists | Using a colorlist definition | |
animations | Operator state based animations with class/style styling |
The use of animations require the tool to be connected to an entity