Optional
bgColor?: stringThe background color of the skymap.
Optional
constellations?: {Optional
boundaries?: { color?: string; data?: string; enabled?: boolean; width?: number }Optional
color?: stringThe color of the boundaries.
Optional
data?: stringURI to the JSON file containing constellations boundaries data.
Optional
enabled?: booleanWhether constellation boundaries are displayed.
Optional
width?: numberThe width of the boundaries.
Optional
lines?: {Optional
color?: stringThe color of the constellation lines.
Optional
data?: stringURI to the JSON file containing constellations lines data.
Optional
enabled?: booleanWhether constellation lines are displayed.
Optional
labels?: { color?: string; data?: string; enabled?: boolean; fontSize?: number }Optional
color?: stringThe color of the labels.
Optional
data?: stringURI to the JSON file containing constellations labels data.
Optional
enabled?: booleanWhether labels are displayed on the constellation lines.
Optional
fontSize?: numberThe font size of the labels.
Optional
width?: numberThe width of the constellation lines.
Optional
fontFamily?: stringThe font family used in the skymap. This should be a valid font name that is
installed on the page and available in the CSS. For example, "Arial", "Helvetica",
or any custom font loaded via @font-face
. Ensure the specified font is accessible
in the browser to avoid fallback to a default font.
Optional
glow?: booleanToggle glow effect for stars and constellations. Can cause performance issues.
Optional
grid?: { color?: string; enabled?: boolean; width?: number }Optional
color?: stringThe color of the grid lines.
Optional
enabled?: booleanWhether the grid is enabled.
Optional
width?: numberThe width of the grid lines.
Optional
language?: stringThe language used for labels. Available languages by default:
Optional
moon?: {Optional
color?: stringThe color of the moon.
Optional
enabled?: booleanWhether the moon is displayed.
Optional
label?: { color?: string; data?: string; enabled?: boolean; fontSize?: number }Moon label configuration.
Optional
color?: stringThe color of the moon label.
Optional
data?: stringURI to the JSON file containing moon labels data.
Optional
enabled?: booleanWhether the moon label is displayed.
Optional
fontSize?: numberThe font size in px of the moon label.
Optional
scale?: numberA multiplier to scale default moon size.
Optional
planets?: {Optional
color?: stringThe color of the planets. If undefined, a planet's color will be used.
Optional
enabled?: booleanWhether planets are displayed.
Optional
labels?: { color?: string; data?: string; enabled?: boolean; fontSize?: number }Labels for planets.
Optional
color?: stringThe color of the labels.
Optional
data?: stringURI to the JSON file containing planets labels data.
Optional
enabled?: booleanWhether planet labels are displayed.
Optional
fontSize?: numberThe font size in px of the planet's labels.
Optional
scale?: numberA multiplier to scale default planet's size.
Optional
stars?: { color?: string; data?: string; enabled?: boolean; scale?: number }Optional
color?: stringThe color of the stars. If undefined, a default will be used.
Optional
data?: stringURI to the JSON file containing star data.
Optional
enabled?: booleanWhether stars are displayed.
Optional
scale?: numberA multiplier to scale default star's size.
Optional
sun?: {Optional
color?: stringThe color of the sun.
Optional
enabled?: booleanWhether the sun is displayed.
Optional
label?: { color?: string; data?: string; enabled?: boolean; fontSize?: number }Sun label configuration.
Optional
color?: stringThe color of the sun label.
Optional
data?: stringURI to the JSON file containing sun labels data.
Optional
enabled?: booleanWhether the sun label is displayed.
Optional
fontSize?: numberThe font size in px of the sun label.
Optional
scale?: numberA multiplier to scale default sun size.
Clones this SkyMap instance, creating a new instance with the same configuration for another container.
The target div element where the skymap will be appended.
The SkyMap instance.
Disconnects SkyMap from container.
Renders the whole map.
Resizes the canvas while maintaining proper device pixel ratio (DPR) scaling.
The size in pixels for both width and height to create a square canvas.
The SkyMap instance.
Updates the sky map's date/time.
The new date/time for astronomical calculations.
The SkyMap instance for chaining.
Animates the change of date/time over a specified duration.
The new date/time for astronomical calculations.
Duration of the animation in milliseconds.
The SkyMap instance for chaining.
Updates the field of view (FOV).
The new field of view in degrees.
The SkyMap instance for chaining.
Updates the observer's latitude.
The new latitude in degrees.
The SkyMap instance for chaining.
Updates both the observer's latitude and longitude.
The new latitude in degrees.
The new longitude in degrees.
The SkyMap instance.
Animates the change of location (latitude and longitude) over a specified duration.
The new latitude in degrees.
The new longitude in degrees.
Duration of the animation in milliseconds.
The SkyMap instance for chaining.
Updates the observer's longitude.
The new longitude in degrees.
The SkyMap instance for chaining.
Replaces the current observer parameters with the given ones.
An object containing the new observer parameters:
latitude
: The new latitude in degrees.longitude
: The new longitude in degrees.date
: The new date/time for astronomical calculations.fov
: The new field of view in degrees.
SkyMap renders an interactive sky map on a canvas element.
It calculates positions of stars, planets, the Moon, the Sun, and constellation features using astronomical formulas and renders them based on a configurable visual style.
Param: container
The target div element where the canvas will be appended.
Param: observerParams
Observer parameters for location and time.
latitude
: The new latitude in degrees.longitude
: The new longitude in degrees.date
: The new date/time for astronomical calculations.fov
: The new field of view in degrees.Param: config
Configuration to customize colors, sizes, language, etc. Uses defaults for missing fields.