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
| Name | Type | Description |
|---|---|---|
map | Groupable | The native map or map fields required by this signature; coordinates and region codes belong to its canvas. |
codes | readonly (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 mutedselected undefined mutedWhat it prints (run when this page was built)