Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

groupTonesfunction

Tones that fade every region outside a group (faint unless another tone is named) and leave the group's own as they are, or give them inside's tones: for a map of a continent drawn on the world, with its neighbours as a pale coast round it.

Import it

import { groupTones } from "@johnmorrisdotca/chizu";

Definition

function groupTones(map: Groupable, codes: ReadonlyArray<string | number>, outside?: string, inside?: Readonly<Record<string, string>>): Record<string, string>

Parameters

NameTypeDescription
mapGroupable

The native map or map fields required by this signature; coordinates and region codes belong to its canvas.

codesreadonly (string | number)[]

Native region codes from this map, in the requested order.

outside (optional)string

The tone assigned to regions outside the chosen group.

inside (optional)Readonly<Record<string, string>>

Optional tone overrides for regions inside the chosen group.

Returns

Record<string, string>

Tones that fade every region outside a group (faint unless another tone is named) and leave the group's own as they are, or give them inside's tones: for a map of a continent drawn on the world, with its neighbours as a pale coast round it.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { groupTones } from "@johnmorrisdotca/chizu";

const tones = groupTones(WORLD, ["JP", "KR"], "muted", { JP: "selected" });
console.log(tones.JP, tones.KR, tones.CN);
// selected undefined muted
selected undefined muted

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.