本文へ移動

Koyomi Calendars暦

カレンダーのページをSVGで描きます。1日を18種類のアイコンで、1か月をポスターや卓上カレンダーで、そして日めくりも使えます。

「暦」(こよみ) は、カレンダーのことです。 名前について(英語)

目次

リファレンス · カレンダーアイコン

CalendarLayout型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Where a theme puts the day and the year; a theme's layout says it once and the drawing and the tests both read it.

インポート

import type { CalendarLayout } from "@johnmorrisdotca/koyomi-calendars";

定義

interface CalendarLayout {
    page: Rect;
    yearZone: Rect | null;
    split?: {
        saturday: readonly [
            number,
            number
        ];
        sunday: readonly [
            number,
            number
        ];
        height: number;
        line: readonly [
            number,
            number,
            number,
            number
        ];
    };
}

メンバー

名前型説明
pageRect

The page the day is centred in, across and (as one block with the month word and the year, when the page shares them) down.

yearZoneRect | null

The room the year chip sits in: it keeps the minimum size and the margin from the bottom of this. null for a look with no year chip.

split (省略可){ saturday: readonly [number, number]; sunday: readonly [number, number]; height: number; line: readonly [number, number, number, number]; } | undefined

Only on a weekend page: where the two numerals sit (their centres), how tall they are, and the diagonal that cuts the page (from top right to bottom left).

例

import { calendarLayout, type CalendarLayout } from "@johnmorrisdotca/koyomi-calendars";

const layout: CalendarLayout = calendarLayout("pins", false);
console.log(layout.page.join(" "));
35 105 243 180

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/koyomi-calendars 0.3.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。