ποΈ We will find the color you want.
color-familyis 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.
To install the color-family package, run the following command:
npm install color-family- JavaScript: ES Modules and CommonJS
- TypeScript: Type definitions provided for ES Modules and CommonJS
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"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"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-family provides three main color families:
- pastel - Soft and bright colors.
- vivid - Saturated and vibrant colors.
- neon - Bright and glowing colors.
.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
codeFormatcan 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 λ μΈ κ°μ§ μ£Όμ μμ κ³μ΄μ μ 곡ν©λλ€:
- pastel(νμ€ν ) - λΆλλ½κ³ λ°μ μμ.
- vivid(λΉλΉλ) - μ λͺ νκ³ ν¬νλ μμ.
- neon(λ€μ¨) - λ°κ³ λΉλλ μμ.
.pastel()- pastel(νμ€ν ) μμμΌλ‘ λ³νν©λλ€.
.vivid()- vivid(λΉλΉλ) μμμΌλ‘ λ³νν©λλ€.
.neon()- neon(λ€μ¨) μμμΌλ‘ λ³νν©λλ€.
.getHexCode([codeFormat])- μμμ hex codeλ₯Ό λ°νν©λλ€.
codeFormatμ"hexCode6"(κΈ°λ³Έκ°) λλ"hexCode8"μΌλ‘ μ λ ₯ν μ μμ΅λλ€.