calendarLayoutfunction
The box, the page and the year's room of a theme, with and without a year.
A weekend page places its numerals on the diagonal, on purpose, the same for every weekend.
Import it
import { calendarLayout } from "@johnmorrisdotca/koyomi-calendars";
Definition
function calendarLayout(theme: CalendarTheme, withYear: boolean, weekend?: boolean): CalendarLayout & { box: Rect; numeral: "centre" | "diagonal"; }
Parameters
| Name | Type | Description |
|---|---|---|
theme | "pins" | "loops" | "shadow" | "heavy" | "cartoon" | "flip" | "stack" | "line" | "curl" | "soft" | "desk" | "thin" | "frame" | "badge" | "sun" | "roll" | "plain" | "squircle" | The design to measure. |
withYear | boolean | Whether the icon shows a year, which takes room. |
weekend (optional) | boolean | Whether to lay out a weekend page (only the designs that have one answer differently). |
Returns
CalendarLayout & { box: Rect; numeral: "centre" | "diagonal"; }
The theme's box (x, y, width, height), the page the day is centred in, the yearZone, and whether the numerals sit in the centre or on the diagonal.
Examples
import { calendarLayout } from "@johnmorrisdotca/koyomi-calendars";
const layout = calendarLayout("squircle", true);
console.log(layout.box.join(" "), layout.numeral);0 0 256 256 centreWhat it prints (run when this page was built)