Widget Canvas Internals
Canvas internals are here.

Widget Canvas provides an API that allows you to programmatically manage and render the widget canvases. All widget canvas tools are found in the Nitrocid.Base.Misc.Widgets.Canvas namespace, which is part of the broader Widgets namespace that contains all widget-related classes.
Widget canvas functions
This API provides a list of functions that allow you to manage the widget canvases, such as getting render info instances and rendering the widgets through the obtained info.
Available functions include:
Obtaining a list of widget render info instances from either a file (
GetRenderInfosFromFile) or a JSON representation (GetRenderInfos)Exporting render information instances to a JSON representation (
ExportRenderInfos) and saving them to a file (SaveRenderInfos)Rendering the widgets from the list of such instances (
RenderFromInfos)
Widget render information class
An instance of a widget render information class is public, and can be accessed (but not modified) by any mod.
Properties of the info class
You can use the following properties:
WidgetName
Specifies a widget by name to render
Bordered
Renders the border around the widget
Relative
Use relative sizes (by margins)
Coordinates
Left and top positions of the widget
Size
Width and height of the widget
Margin
Margin size of the widget
JSON structure
Any mod can render a widget canvas, with the JSON information that satisfies the following format:
The only required options are widgetName, which chooses a widget to render, left, for the left position that is zero-based, and top, for the top position that is zero-based.
Optional properties
The rest of the properties are defined as follows:
bordered
Whether to draw a border around the widget or not.
relative
Whether to use relative widths and heights or not.
options
Specifies the options for the widgets.
Relative widths and heights
If the relative widths and heights are turned on, the following options apply:
widthLeftMargin
Left margin for the width of the console window.
widthRightMargin
Right margin for the width of the console window.
heightTopMargin
Top margin for the height of the console window.
heightBottomMargin
Bottom margin for the height of the console window.
Else, the following options apply:
width
Width of the widget.
height
Height of the widget.
Widget-specific options
Some widgets, especially those that support customization options, provide their own options. The following options are available:
TextWidget
text
Specifies the text to display.
Photo
photoPath
Specifies a path to the image to be displayed.
NotificationIcons
alignment
Text alignment for the notification icons.
Last updated