Class DrawableRect
A rectangle with a fill, rounded corners and a border, made with Drawable.rect.
Extends: Drawable
Drawable.rect(spec) takes the same fields by name: the ones below and the shared ones.
- With no spec it draws nothing until it has anchors and a
fillorborder_width.
A focus ring that fades in around a window:
lua
local focus_ring = Drawable.rect({
left = -3, right = -3, top = -3, bottom = -3,
radius = 10, border_width = 3, border_color = "#ebcb8b00",
})
window.drawables:add(focus_ring)
focus_ring.border_color = Anim.tween("#ebcb8bff", 200)Properties
Every field here reads back as an Animated, even when given a plain value. Colours are "#rrggbb" or "#rrggbbaa".
drawable.fill: string | Animated | nilfill
The colour inside the rectangle.
- Default: nil, no fill. false clears it too.
drawable.radius: number | Animatedradius
Rounds the corners, in logical pixels.
- Default: 0.
- 0 to 16384. Each corner is at most half the shorter side.
drawable.border_width: number | Animatedborder_width
A border drawn inside the edges, so it doesn't change the size.
- Default: 0.
- 0 to 4096.
drawable.border_color: string | Animatedborder_color
The border's colour.
- Default:
"#000000ff", black.