Use this file to discover all available pages before exploring further.
The style API controls the visual appearance of every element: fill colors, gradients, images, borders, rounded corners, drop shadows, backdrop blur, and 2D transforms. Most methods are defined on StyleSetterBase<T> and flow through to the element’s internal style dictionary. All methods return ElementBuilder for chaining unless otherwise noted.
public ElementBuilder BackgroundRadialGradient( float centerX, float centerY, float innerRadius, float outerRadius, Color innerColor, Color outerColor)
public ElementBuilder BackgroundBoxGradient( float centerX, float centerY, float width, float height, float radius, float feather, Color innerColor, Color outerColor)
A rounded-rectangle gradient — useful for “inner glow” or bevelled panel effects. radius rounds the box corners; feather controls the softness of the transition zone.
A texture handle created by the renderer backend (e.g. from Paper.CreateTexture). The image is stretched to fill the element rect; use the Image() method for fit/fill scale modes.
All transform methods are composited by the renderer into the element’s final transform matrix. TransformOrigin sets the pivot point around which rotation and scale are applied (defaults to the element’s top-left corner).
State blocks let you apply a set of style properties only when the element is in a particular interactive state. Open the block with a state property accessor, chain style calls, then always close with .End() to return to ElementBuilder.
// State accessors — each returns StateDrivenStylepublic StateDrivenStyle Normal { get; } // always appliedpublic StateDrivenStyle Hovered { get; } // while cursor is over the elementpublic StateDrivenStyle Active { get; } // while mouse button is held downpublic StateDrivenStyle Focused { get; } // while the element has keyboard focus// Conditional accessorpublic StateDrivenStyle If(bool condition)// Close the block// StateDrivenStyle.End() : ElementBuilder
Every state block must be closed with .End(). Forgetting .End() causes subsequent method calls to silently target the StateDrivenStyle object instead of the ElementBuilder, leading to properties being discarded.
StateDrivenStyle exposes the same background, border, rounding, shadow, transform, and transition methods as ElementBuilder — they simply no-op when the state condition is false, so there is no runtime cost when inactive.
Applies all properties from a pre-built StyleTemplate to this element. Templates are useful for sharing a visual “theme” across many elements without repeating property chains.
var dangerButton = new StyleTemplate() .BackgroundColor(Color32.FromArgb(255, 200, 50, 50)) .Rounded(6f) .BorderColor(Color32.FromArgb(255, 240, 80, 80)) .BorderWidth(1f);Paper.Element("delete-btn").Style(dangerButton);
Looks up one or more named styles registered with Paper and applies them along with any state-appropriate variants (e.g. a :hover sub-style). StyleIf is a conditional shorthand — it does nothing when condition is false.
Source element to inherit from. When null, inherits from the direct parent in the current element stack.
Sets the element’s style parent, so any unset properties cascade down from the source. Useful for consistent text color or font size across a container’s descendants.
Optional callback invoked each frame to push per-frame uniform values before the element’s rect is drawn.
Replaces the default background fill with a custom GLSL (or equivalent) shader. The shader receives the element’s bounding rect as the draw area. Use setupUniforms to pass time, resolution, or any other per-element data.