dorodango is a Typst package for drawing squircles.
Background
Squircles are rounded rectangles with corners that blend smoothly into their straight edges. Unlike a standard rounded rectangle, which transitions abruptly from a straight edge to a circular arc, a squircle changes curvature gradually around each corner. As a result, a squircle reads as one unified shape, rather than a square that has simply had its corners clipped or rounded off.
Refer to the manual for a full API reference and usage examples.
Quickstart
In a Typst document, import the dorodango package:
#import "@preview/dorodango:0.2.0": *
dorodango provides a squircle function that mirrors the built-in rect element but adds parameters for controlling corner smoothing. The example below compares a rectangle and a squircle of the same size and corner radius, illustrating how their corner-to-edge transitions differ.
#grid(
columns: (1fr, 1fr),
gutter: 14pt,
rect(width: 90pt, height: 60pt, radius: (top-left: 50%), fill: aqua),
squircle(
width: 90pt,
height: 60pt,
radius: (top-left: 50%),
smoothing: 100%,
fill: aqua,
),
)
Customize squircle corners
Two parameters control the appearance of a squircle’s corners:
smoothingcontrols how gradually a straight edge blends into its rounded corner. At0%, the shape is an ordinary rounded rectangle. Higher values make the transition more gradual, and at100%the circular arc has zero length and the two Bézier transitions meet at a single point.preserve-smoothingdetermines how the corner adapts when its requested radius and smoothing do not both fit.
The shapes below share the same size and radius. The final shape preserves its requested smoothing after it no longer fits.
#grid(
columns: (1fr, 1fr, 1fr),
gutter: 14pt,
squircle(
width: 85pt,
height: 55pt,
radius: 20pt,
smoothing: 5%,
fill: aqua,
),
squircle(
width: 85pt,
height: 55pt,
radius: 20pt,
smoothing: 100%,
fill: aqua,
),
squircle(
width: 85pt,
height: 55pt,
radius: 20pt,
smoothing: 100%,
preserve-smoothing: true,
fill: aqua,
),
)