RPIC

rotated & colour literals

Two small conveniences for figures: rotated labels and native colour literals.

rotated <degrees>

A per-string text attribute (binding like ljust — to the string it follows). Angles are counter-clockwise, pic’s convention; the rotation pivots on the text’s anchor point.

.PS
margin = 0.12
A: arrow right 2.4 "gradient ascent" rotated 18 above
"y axis" rotated 90 at A.start + (-0.3, 0.55)
arrow from A.start up 1.1 dashed
.PE
gradient ascent y axis

aligned — follow the line

aligned (pikchr’s spelling) rotates a label to the host segment’s angle automatically, so edge labels ride their line. It works on linear objects (line/arrow/spline) and normalizes the angle to keep the text upright — a leftward or downward segment reads horizontally, never upside down.

.PS
margin = 0.12
arrow from (0,0) to (2.4,1.3) "gradient ascent" aligned above
arrow from (0,0) to (2.4,-1.1) "descent" aligned below
.PE
gradient ascent descent

Colour literals: rgb(r,g,b) and 0xRRGGBB

The colour grammar (for outlined, shaded, color, hatchcolor and gradient) accepts two native literal forms besides names and strings:

.PS
box shaded rgb(27,94,32) "rgb()" bold wid 1
circle outlined 0xb3261e rad 0.35 at last box.e + (0.9,0) "hex" italic
.PE
rgb() hex

A colour can also be held in a variable or computed, so a palette defined once drives a whole figure (handy for the for-loops that plot the easing curves):

.PS
accent = 0x2f855a
box outlined accent "variable" wid 1
circle shaded (accent + 0x60) rad 0.35 at last box.e + (0.9,0) "expr" italic
.PE
variable expr

Any unknown colour name — a typo ("crimsom"), a malformed hex ("#12g456") — is flagged with an invalid_color warning in the --json bundle (with a “did you mean” suggestion), instead of silently rendering blank. The colour is still passed through unchanged, so the warning is advisory and never blocks rendering. Valid forms — the CSS named colours, #hex, rgb()/hsl(), and the dvips/xcolor names the dpic corpus uses (Dandelion, Goldenrod, …) — stay quiet.