Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Installation and Usage

Sriman edited this page Aug 10, 2025 · 2 revisions

Installation

Kolory can be installed via all major package managers or used directly in the browser via a CDN.

Using Package Managers

# npm
npm install kolory

# yarn
yarn add kolory

# pnpm
pnpm add kolory

# bun
bun add kolory

Using CDN (Browser)

Include Kolory in your HTML for browser-based projects:

<!-- UNPKG -->
<script src="https://unpkg.com/kolory/dist/index.iife.js"></script>

<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/kolory/dist/index.iife.js"></script>

<!-- ESM (Modern Browsers) -->
<script type="module">
  import kolory from 'https://esm.sh/kolory';
</script>

Usage

Kolory provides a straightforward API to access and manipulate colors in various formats. Below are examples for different environments.

ESM (Modern JavaScript)

import kolory, { hex, rgb, rgba, hsl, hsla } from 'kolory';

console.log(kolory.hex.blue_metal);
console.log(hex.blue_metal);
console.log(rgb.blue_metal);

CommonJS

const { hex, rgb } = require('kolory');

console.log(hex.sunset_orange);
console.log(rgb.sunset_orange);

Browser (IIFE via CDN)

<script src="https://unpkg.com/kolory/dist/index.iife.js"></script>
<script>
  console.log(kolory.hex.blue_metal);
</script>

Sponsor me on GitHub Twitter

Clone this wiki locally