Reference · Flag source and framing metadata
FlagColourtype
One colour of a flag, measured from the shipped drawing (the flag's own, never a frame or a crop) drawn 1200 pixels
wide: every pixel counted by its exact colour, the smoothed edges and the steps of a gradient given to the nearest
colour that covers at least 0.1% of the flag (pnpm data:colours, scripts/colours.mjs).
Import it
import type { FlagColour } from "@johnmorrisdotca/hata/manifest";
Also exported from: @johnmorrisdotca/hata/search
Definition
interface FlagColour {
hex: string;
share: number;
name: ColourName;
}
Members
| Name | Type | Description |
|---|---|---|
hex | string | The colour as the drawing has it, |
share | number | The share of the flag's drawn area it covers, from 0 to 1, to four decimals. |
name | ColourName | The nearest name of the closed list: see |
Examples
import { manifest, type FlagColour } from "@johnmorrisdotca/hata/manifest";
const japan: FlagColour[] = manifest("JP")?.colours ?? [];
console.log(japan); // [{ hex: "#ffffff", share: 0.8116, name: "white" }, { hex: "#bc002d", share: 0.1884, name: "red" }][
{ hex: '#ffffff', share: 0.8116, name: 'white' },
{ hex: '#bc002d', share: 0.1884, name: 'red' }
]What it prints (run when this page was built)