Skip to content

Elements

opencatwebjson.elements

Page dataclass

Page(
    background_color,
    page_title,
    icon,
    search_description,
    thumbnail,
)

Represents a page in the application with visual and metadata properties.

Attributes:

Name Type Description
background_color HexColor

Page background color.

page_title str

Title of the page.

icon int

ID of the page icon decal.

search_description str

Description for search functionality.

thumbnail int

ID of the page thumbnail decal.

Frame dataclass

Frame(
    name,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

A container UI element for grouping and positioning child elements.

Attributes:

Name Type Description
name str

Frame identifier.

background_transparency Range01

Background transparency (0-1).

background_color HexColor

Background color of the frame.

position Vector2

Position of the frame.

size Size2

Width and height of the frame.

rotation Rotation

Rotation applied to the frame.

anchor_point Vec2

Anchor point for positioning.

layer int

Rendering order index.

tooltip str

Tooltip text displayed on hover.

clip_descendants bool

If True, child elements outside bounds are clipped.

visible bool

Determines visibility of the frame.

Text dataclass

Text(
    name,
    text,
    font,
    font_style,
    font_weight,
    horizontal_alignment,
    vertical_alignment,
    text_size,
    text_color,
    text_transparency,
    rich,
    wrap,
    truncate,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Represents a text UI element with styling and layout properties.

Attributes:

Name Type Description
name str

Element identifier.

text str

Displayed text.

font str

Font name.

font_style FontStyle

Font style (e.g., italic).

font_weight FontWeight

Font weight (e.g., bold).

horizontal_alignment HorizontalAlignment

Horizontal text alignment.

vertical_alignment VerticalAlignment

Vertical text alignment.

text_size TextSize

Text size.

text_color HexColor

Text color.

text_transparency Range01

Text transparency (0-1).

rich bool

Enables rich text formatting.

wrap bool

Text wraps inside bounds.

truncate Truncate

Truncation mode for overflowing text.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position of the text element.

size Size2

Width and height.

rotation Rotation

Rotation applied to text.

anchor_point Vec2

Anchor point for positioning.

layer int

Rendering layer index.

tooltip str

Tooltip text on hover.

clip_descendants bool

Clips children if True.

visible bool

Visibility of the element.

Image dataclass

Image(
    name,
    image_id,
    image_transparency,
    scale_type,
    tint,
    resample_mode,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Represents an image element in the UI.

Attributes:

Name Type Description
name str

Element identifier.

image_id int

ID of the decal image.

image_transparency Range01

Image transparency.

scale_type ScaleType

Scaling mode of the image.

tint HexColor

Tint applied to the image.

resample_mode ResampleMode

Image resampling mode.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position of the image element.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point for positioning.

layer int

Rendering order index.

tooltip str

Tooltip text.

clip_descendants bool

Clips children if True.

visible bool

Visibility.

Link(
    name,
    reference,
    open_in_new_tab,
    text,
    font,
    font_style,
    font_weight,
    horizontal_alignment,
    vertical_alignment,
    text_size,
    text_color,
    text_transparency,
    automatic_color,
    rich,
    wrap,
    truncate,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Clickable hyperlink UI element with text styling.

Attributes:

Name Type Description
name str

Element identifier.

reference str

URL or internal reference target.

open_in_new_tab bool

Opens link in a new tab if True.

text str

Displayed text.

font str

Font name.

font_style FontStyle

Font style.

font_weight FontWeight

Font weight.

horizontal_alignment HorizontalAlignment

Horizontal text alignment.

vertical_alignment VerticalAlignment

Vertical text alignment.

text_size TextSize

Text size.

text_color HexColor

Text color.

text_transparency Range01

Text transparency.

automatic_color bool

Automatically adjust color based on theme.

rich bool

Enables rich text.

wrap bool

Enables text wrapping.

truncate Truncate

Text truncation method.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point.

layer int

Rendering order.

tooltip str

Tooltip text.

clip_descendants bool

Clips children if True.

visible bool

Visibility.

Button dataclass

Button(
    name,
    text,
    font,
    font_style,
    font_weight,
    horizontal_alignment,
    vertical_alignment,
    text_size,
    text_color,
    text_transparency,
    automatic_color,
    rich,
    wrap,
    truncate,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Clickable button element with text and styling properties.

Attributes:

Name Type Description
name str

Element identifier.

text str

Displayed text.

font str

Font name.

font_style FontStyle

Font style.

font_weight FontWeight

Font weight.

horizontal_alignment HorizontalAlignment

Text horizontal alignment.

vertical_alignment VerticalAlignment

Text vertical alignment.

text_size TextSize

Text size.

text_color HexColor

Text color.

text_transparency Range01

Text transparency.

automatic_color bool

Adjust color automatically.

rich bool

Rich text enabled.

wrap bool

Wrap text inside element.

truncate Truncate

Truncation method.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point.

layer int

Rendering layer.

tooltip str

Tooltip text.

clip_descendants bool

Clip children.

visible bool

Visibility.

Donation dataclass

Donation(
    name,
    item_id,
    reference,
    product_type,
    text,
    font,
    font_style,
    font_weight,
    horizontal_alignment,
    vertical_alignment,
    text_size,
    text_color,
    text_transparency,
    automatic_color,
    rich,
    wrap,
    truncate,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Represents a purchasable donation item element.

Attributes:

Name Type Description
name str

Element identifier.

item_id int

ID of the item.

reference str

Reference URL or product link.

product_type ProductType

Type of product.

text str

Displayed text.

font str

Font name.

font_style FontStyle

Font style.

font_weight FontWeight

Font weight.

horizontal_alignment HorizontalAlignment

Text alignment horizontal.

vertical_alignment VerticalAlignment

Text alignment vertical.

text_size TextSize

Text size.

text_color HexColor

Text color.

text_transparency Range01

Text transparency.

automatic_color bool

Auto color adjustment.

rich bool

Enable rich text.

wrap bool

Wrap text.

truncate Truncate

Truncate method.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point.

layer int

Rendering order.

tooltip str

Tooltip text.

clip_descendants bool

Clip children if True.

visible bool

Visibility.

Input dataclass

Input(
    name,
    placeholder,
    text,
    font,
    font_style,
    font_weight,
    horizontal_alignment,
    vertical_alignment,
    text_size,
    text_color,
    text_transparency,
    placeholder_color,
    automatic_color,
    rich,
    wrap,
    truncate,
    editable,
    multi_line,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Input text element for user input.

Attributes:

Name Type Description
name str

Element identifier.

placeholder str

Placeholder text.

text str

Current input text.

font str

Font name.

font_style FontStyle

Font style.

font_weight FontWeight

Font weight.

horizontal_alignment HorizontalAlignment

Text horizontal alignment.

vertical_alignment VerticalAlignment

Text vertical alignment.

text_size TextSize

Text size.

text_color HexColor

Text color.

text_transparency Range01

Text transparency.

placeholder_color HexColor

Placeholder text color.

automatic_color bool

Auto color adjustment.

rich bool

Rich text enabled.

wrap bool

Wrap text inside bounds.

truncate Truncate

Truncate method.

editable bool

If True, text is editable.

multi_line bool

Multi-line input.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point.

layer int

Rendering layer.

tooltip str

Tooltip text.

clip_descendants bool

Clip children if True.

visible bool

Visibility.

ScrollableFrame dataclass

ScrollableFrame(
    name,
    scrollbar_color,
    scrollbar_transparency,
    scrollbar_thickness,
    canvas_size,
    background_transparency,
    background_color,
    position,
    size,
    rotation,
    anchor_point,
    layer,
    tooltip,
    clip_descendants,
    visible,
)

Frame element with a scrollable canvas.

Attributes:

Name Type Description
name str

Element identifier.

scrollbar_color HexColor

Scrollbar color.

scrollbar_transparency Range01

Scrollbar transparency.

scrollbar_thickness int

Scrollbar thickness.

canvas_size CanvasSize

Scrollable canvas size.

background_transparency Range01

Background transparency.

background_color HexColor

Background color.

position Vector2

Position.

size Size2

Width and height.

rotation Rotation

Rotation applied.

anchor_point Vec2

Anchor point.

layer int

Rendering layer.

tooltip str

Tooltip text.

clip_descendants bool

Clip children if True.

visible bool

Visibility.

Script dataclass

Script(name, enabled, _content)

Script element representing executable code.

Attributes:

Name Type Description
name str

Script identifier.

enabled bool

If True, the script is active.

_content Any

Script content placeholder (implementation TBD).

Outline dataclass

Outline(
    name,
    mode,
    type,
    outline_color,
    outline_thickness,
    outline_transparency,
)

Styling outline applied to UI elements.

Attributes:

Name Type Description
name str

Outline identifier.

mode OutlineMode

Outline mode.

type OutlineType

Outline type.

outline_color HexColor

Outline color.

outline_thickness int

Outline thickness.

outline_transparency Range01

Outline transparency.

Corner dataclass

Corner(name, radius)

Rounded corner styling for UI elements.

Attributes:

Name Type Description
name str

Corner identifier.

radius Tuple2

Corner radius.

List dataclass

List(
    name,
    direction,
    padding,
    vertical_alignment,
    horizontal_alignment,
    wrap,
)

A list container layout element.

Attributes:

Name Type Description
name str

Element identifier.

direction ListDirection

List direction (vertical/horizontal).

padding Tuple2

Padding between items.

vertical_alignment VerticalAlignment

Vertical alignment of list items.

horizontal_alignment HorizontalAlignment

Horizontal alignment.

wrap bool

If True, items wrap within container.

Grid dataclass

Grid(
    name,
    padding,
    size,
    vertical_alignment,
    horizontal_alignment,
)

Grid container layout element.

Attributes:

Name Type Description
name str

Element identifier.

padding Tuple2

Padding between grid cells.

size Size2

Cell size.

vertical_alignment VerticalAlignment

Vertical alignment.

horizontal_alignment HorizontalAlignment

Horizontal alignment.

AspectRatio dataclass

AspectRatio(name, ratio)

Maintains a fixed aspect ratio for an element.

Attributes:

Name Type Description
name str

Element identifier.

ratio int

Width-to-height ratio.

Constraint dataclass

Constraint(name, minimum_size, maximum_size)

Size constraints for UI elements.

Attributes:

Name Type Description
name str

Element identifier.

minimum_size Tuple2

Minimum width and height.

maximum_size MaxSize

Maximum allowed size.

Gradient dataclass

Gradient(
    name,
    rotation,
    offset,
    gradient_transparency,
    gradient_color,
)

Gradient styling element.

Attributes:

Name Type Description
name str

Element identifier.

rotation Rotation

Gradient rotation.

offset Tuple2

Gradient offset.

gradient_transparency TransparencyGradient

Transparency gradient.

gradient_color ColorGradient

Color gradient.

Padding dataclass

Padding(name, bottom, left, right, top)

Padding applied to a UI element.

Attributes:

Name Type Description
name str

Element identifier.

bottom Tuple2

Bottom padding.

left Tuple2

Left padding.

right Tuple2

Right padding.

top Tuple2

Top padding.