Get-SpectreRenderableSize
Description
The Get-SpectreRenderableSize function gets the height of a Spectre Console renderable object. The width and height is estimated.
This method of size calculation is not perfect, but it is a good approximation for most use cases. There are factors outside of the control of this function that can affect the size of the widget once it’s rendered to the console.
The size of a containing object can influence the size of the widget when it’s expandable. If you know the width and height of a container that this widget will be rendered inside you can provide that as a parameter to get a more accurate size.
Examples
Example 1
This example calculates the height of a small panel
Parameters
Renderable
Type | Required | Position | PipelineInput |
---|---|---|---|
[Renderable] | true | 1 | true (ByValue) |
ContainerHeight
The height of the container that the widget will be rendered inside.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Int32] | false | 2 | false |
ContainerWidth
The width of the container that the widget will be rendered inside.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Int32] | false | 3 | false |