Rough.js allows you to fill shapes with various hand-drawn styles. You can pass an options object as the last argument to shape methods.
Available fillStyle values:
hachure (default)solidzigzagcross-hatchdotsdashedzigzag-line
Common Fill Options:
fill: The color of the fill (e.g., 'red', 'rgb(10,150,10)', 'rgba(255,0,200,0.2)').fillStyle: The style of the fill (see list above).fillWeight: Thickness of the hachure lines.hachureAngle: The angle of the hachure lines.hachureGap: The spacing between hachure lines.
// Example: Solid fill
rc.rectangle(120, 105, 80, 80, { fill: 'rgba(255,0,200,0.2)', fillStyle: 'solid' });
// Example: Custom hachure
rc.rectangle(220, 15, 80, 80, {
fill: 'red',
hachureAngle: 60,
hachureGap: 8
});
// Example: Thicker hachure lines
rc.circle(50, 150, 80, {
fill: 'rgb(10,150,10)',
fillWeight: 3
});