color

Methods

(static) hexToRgb(hex) → {Array.<number>}

hex('#ff0000') 컬러값을 rgb([255,0,0]) 형태로 변환 합니다.
Parameters:
Name Type Description
hex string 변환할 컬러값
Source:
Returns:
Type
Array.<number>
Example
console.log(hexToRgb("#ff0000")); // [255, 0, 0]
console.log(hexToRgb("#12ff34")); // [18, 255, 52]

(static) inHexRange(minHex, maxHex, percent) → {Array.<number>}

minHex 와 maxHex 값 사이의 percent 에 해당하는 rgb 값을 반환 합니다.
Parameters:
Name Type Description
minHex string
maxHex string
percent number
Source:
Returns:
Type
Array.<number>
Example
const min = "#c80000";
const max = "#ffff00";
console.log(inHexRange(min, max, 0)); // [200, 0, 0]
console.log(inHexRange(min, max, 0.25)); // [214, 64, 0]
console.log(inHexRange(min, max, 0.5)); // [228, 128, 0]
console.log(inHexRange(min, max, 0.75)); // [241, 191, 0]
console.log(inHexRange(min, max, 1)); // [255, 255, 0]

(static) inRgbRange(minRgb, maxRgb, percent) → {Array.<number>}

minRgb 과 maxRgb 값 사이의 percent 에 해당하는 rgb 값을 반환 합니다.
Parameters:
Name Type Description
minRgb Array.<number>
maxRgb Array.<number>
percent number
Source:
Returns:
Type
Array.<number>
Example
const min = [200, 0, 0];
const max = [255, 255, 0];
console.log(inRgbRange(min, max, 0)); // [200, 0, 0]
console.log(inRgbRange(min, max, 0.25)); // [214, 64, 0]
console.log(inRgbRange(min, max, 0.5)); // [228, 128, 0]
console.log(inRgbRange(min, max, 0.75)); // [241, 191, 0]
console.log(inRgbRange(min, max, 1)); // [255, 255, 0]

(static) rgbToHex(rgb) → {string}

rgb([255,0,0]) 컬러값을 hex(#ff0000) 형태로 변환합니다.
Parameters:
Name Type Description
rgb Array.<number> 변환할 컬러값
Source:
Returns:
Type
string
Example
console.log(rgbToHex([255, 0, 0])); // "#ff0000"
console.log(rgbToHex([12, 0, 0])); // "#0c0000"