Assign custom class to canvas

Use case or problem

I have several canvases within one vault that I use for different purposes. I’d like to style them independently using css.

Proposed solution

Allow users to add css class properties to the canvas element itself. The style sheet can then select elements based on the parent canvas class instead of relying on the workaround below.

Current workaround (optional)

Current workaround is to use the :has() pseudo-class to identify elements within the canvas to select the canvas itself then style from there. It works well enough but one big drawback is that the targeted element(s) used to select the canvas must be on screen and loaded so if you zoom or pan away from them, the canvas is no longer selectable by the style sheet and the formatting reverts to default.

Related feature requests (optional)

I searched but couldn’t find any.

Maybe this could help?