0.1.5 β€’ Published 11 months ago

color-family v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

color-family Β· Latest Version MIT License

πŸ–οΈ We will find the color you want.

* This document supports English and Korean.

🏷️ English:

Introduction

  • color-family is a JavaScript package.
  • You can generate hex codes for various color families such as pastel, neon, and more.
  • You can either provide a base color manually or generate a random color, and then transform it into a specific color family.

Installation

To install the color-family package, run the following command:

npm install color-family

Supported Environments

  • JavaScript: ES Modules and CommonJS
  • TypeScript: Type definitions provided for ES Modules and CommonJS

Usage

β‘  - Using a Base Color β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* Register with a base color */
const red = new ColorFamily('red');
console.log(red.getHexCode()) // βœ… Expected output: "#ff0000"

/* Convert to pastel */
const pastelRed = red.pastel();
console.log(pastelRed.getHexCode()); // βœ… Expected output: "#efb9b9"

/* Convert to neon */
const neonRed = red.neon()
console.log(neonRed.getHexCode()) // βœ… Expected output: "#f63c3c"

β‘‘ - Generate a Random Color and Transform It β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* Generate a random color */
const random = new ColorFamily()
console.log(random.getHexCode()) // βœ… Expected output: "#0a9788"

/* Convert to pastel */
const pastelRandom = random.pastel()
console.log(pastelRandom.getHexCode()) // βœ… Expected output: "#acece5" 

/* Convert to neon */
const neonRandom = random.neon()
console.log(neonRandom.getHexCode()) // βœ… Expected output: "#3df5e1"

β‘’ - Custom Color β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* Use a custom color */
const custom = new ColorFamily('#ed7402')
console.log(custom.getHexCode()) // βœ… Expected output: "#ed7402"

/* Convert to pastel */
const pastelCustom = custom.pastel()
console.log(pastelCustom.getHexCode()) // βœ… Expected output: "#e9c6a5"

/* Convert to neon */
const neonCustom = custom.neon()
console.log(neonCustom.getHexCode()) // βœ… Expected output: "#f79436"

Color Families

color-family provides three main color families:

  1. pastel - Soft and bright colors.
  2. vivid - Saturated and vibrant colors.
  3. neon - Bright and glowing colors.

Key Methods

  • .pastel()
    • Transforms the color into a pastel tone.
  • .vivid()
    • Transforms the color into a vivid tone.
  • .neon()
    • Transforms the color into a neon tone.
  • .getHexCode([codeFormat])
    • Returns the hex code of the color.
    • The codeFormat can be either "hexCode6" (default) or "hexCode8".

🏷️ ν•œκ΅­μ–΄:

μ†Œκ°œ

  • color-family λŠ” μžλ°”μŠ€ν¬λ¦½νŠΈ νŒ¨ν‚€μ§€μž…λ‹ˆλ‹€.
  • νŒŒμŠ€ν…” 색상, λ„€μ˜¨ 색상 λ“± λ‹€μ–‘ν•œ 색상 κ³„μ—΄μ˜ hex codeλ₯Ό 생성할 수 μžˆμŠ΅λ‹ˆλ‹€.
  • 직접 κΈ°μ€€ 색상을 λ“±λ‘ν•˜κ±°λ‚˜ λ¬΄μž‘μœ„ 색상을 좔첨받아, νŠΉμ • 색상 κ³„μ—΄λ‘œ λ³€ν™˜ν•΄λ³΄μ„Έμš”.

μ„€μΉ˜

color-family νŒ¨ν‚€μ§€λ₯Ό μ„€μΉ˜ν•˜λ €λ©΄, λ‹€μŒ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•΄μ£Όμ„Έμš”.

npm install color-family

지원 ν™˜κ²½

  • JavaScript: ES λͺ¨λ“ˆ 및 CommonJS ν™˜κ²½μ—μ„œ μ‚¬μš© κ°€λŠ₯
  • TypeScript: ES λͺ¨λ“ˆκ³Ό CommonJS용 νƒ€μž… μ •μ˜ 제곡

μ‚¬μš©λ²•

β‘  - κΈ°λ³Έ 색상 ν™œμš© β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* κΈ°λ³Έ μƒ‰μƒμœΌλ‘œ 졜초 등둝 */
const red = new ColorFamily('red');
console.log(red.getHexCode()) // βœ… 좜λ ₯ 예: "#ff0000"

/* νŒŒμŠ€ν…” μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const pastelRed = red.pastel();
console.log(pastelRed.getHexCode()); // βœ… 좜λ ₯ 예: "#efb9b9"

/* λ„€μ˜¨ μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const neonRed = red.neon()
console.log(neonRed.getHexCode()) // βœ… 좜λ ₯ 예: "#f63c3c"

β‘‘ - λ¬΄μž‘μœ„ 색상 좔첨 ν›„, λ³€ν™˜ β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* λ¬΄μž‘μœ„ 색상 μ§€μ • */
const random = new ColorFamily()
console.log(random.getHexCode()) // βœ… 좜λ ₯ 예: "#0a9788"

/* νŒŒμŠ€ν…” μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const pastelRandom = random.pastel()
console.log(pastelRandom.getHexCode()) // βœ… 좜λ ₯ 예: "#acece5" 

/* λ„€μ˜¨ μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const neonRandom = random.neon()
console.log(neonRandom.getHexCode()) // βœ… 좜λ ₯ 예: "#3df5e1"

β‘’ - μ‚¬μš©μž μ§€μ • β—ΌοΈŽ β—ΌοΈŽ β—ΌοΈŽ

import { ColorFamily } from 'color-family';

/* λ¬΄μž‘μœ„ 색상 μ§€μ • */
const custom = new ColorFamily('#ed7402')
console.log(custom.getHexCode()) // βœ… 좜λ ₯ 예: "#ed7402"

/* νŒŒμŠ€ν…” μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const pastelCustom = custom.pastel()
console.log(pastelCustom.getHexCode()) // βœ… 좜λ ₯ 예: "#e9c6a5"

/* λ„€μ˜¨ μƒ‰μƒμœΌλ‘œ λ³€ν™˜ */
const neonCustom = custom.neon()
console.log(neonCustom.getHexCode()) // βœ… 좜λ ₯ 예: "#f79436"

색상 계열

color-family λŠ” μ„Έ κ°€μ§€ μ£Όμš” 색상 계열을 μ œκ³΅ν•©λ‹ˆλ‹€:

  1. pastel(νŒŒμŠ€ν…”) - λΆ€λ“œλŸ½κ³  밝은 색상.
  2. vivid(λΉ„λΉ„λ“œ) - μ„ λͺ…ν•˜κ³  ν¬ν™”λœ 색상.
  3. neon(λ„€μ˜¨) - 밝고 λΉ›λ‚˜λŠ” 색상.

μ£Όμš” λ©”μ„œλ“œ

  • .pastel()
    • pastel(νŒŒμŠ€ν…”) μƒ‰μƒμœΌλ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€.
  • .vivid()
    • vivid(λΉ„λΉ„λ“œ) μƒ‰μƒμœΌλ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€.
  • .neon()
    • neon(λ„€μ˜¨) μƒ‰μƒμœΌλ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€.
  • .getHexCode([codeFormat])
    • μƒ‰μƒμ˜ hex codeλ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.
    • codeFormat 은 "hexCode6"(κΈ°λ³Έκ°’) λ˜λŠ” "hexCode8" 으둜 μž…λ ₯ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago