1.2.0 β’ Published 4 months ago
skymap v1.2.0
π SkyMap β Interactive & Customizable Star Map for JavaScript
SkyMap is a lightweight, highly customizable JavaScript/TypeScript library for rendering a realistic sky map on an HTML <canvas>
. It supports modern frontend frameworks like React, Vue, Svelte, and Next.js, while remaining easy to use in plain JavaScript.
π Designed for simplicity, customization, and performance.
β¨ Features
- Realistic Star Rendering β Uses scientifically accurate colors and positions.
- Customizable β Adjust colors, sizes, labels and more.
- Framework-Agnostic β Compatible with Vanilla JS, React, Vue, Svelte, Next.js, and others.
- Optimized for Performance β Smooth rendering with efficient WebGL & Canvas APIs.
- Supports Real-Time Updates β Change time, location, and visibility dynamically.
- Well-Documented β Clear API with examples for easy integration.
π Installation
Install via npm, pnpm, yarn or bun:
npm install skymap
yarn add skymap
pnpm add skymap
bun add skymap
π Quick Start
πΉ Vanilla JavaScript (Plain HTML)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sky Map</title>
</head>
<body>
<div id="sky-container" style="width: 500px; height: 500px;"></div>
<script type="module">
import SkyMap from "skymap";
const container = document.getElementById("sky-container");
const skymap = SkyMap(
container,
{
date: new Date("2023-01-01T12:00:00Z"),
},
{
bgColor: "#0a0d13",
constellations: {
lines: {
labels: {
enabled: false,
},
},
},
}
);
</script>
</body>
</html>
<!--
βοΈ Configuration Options
You can customize the sky map with various options:
new SkyMap(container, {
latitude: 52.52, // Observer's latitude
longitude: 13.405, // Observer's longitude
datetime: new Date(), // Time for the sky projection
showConstellations: true, // Show constellation lines
starBrightness: 1.0, // Adjust star brightness
projection: "stereographic" // Projection type: "stereographic", "mercator", etc.
});
π οΈ API Methods
sky.setDate(new Date("2025-06-15T22:00:00Z")); // Change date/time
sky.setLocation(34.05, -118.25); // Update observerβs location
sky.toggleConstellations(); // Show/hide constellation lines
sky.destroy(); // Clean up the instance
-->
π Documentation & Examples
π Full API Documentation: skewb1k.github.io/skymap
π License
Licensed under the MIT License. See LICENSE for details.
β Support the Project!
If you like SkyMap, consider starring the repo! β