colors-formater
Advanced tools
Comparing version 0.0.8 to 0.0.9-alpha
30
index.js
"use strict"; | ||
/** | ||
* | ||
* | ||
* @example | ||
@@ -9,14 +9,14 @@ * // Init with hexa color | ||
* const color = Colors('#123') | ||
* const color = Colors('#ABCDEF') | ||
* | ||
* const color = Colors('#ABCDEF') | ||
* | ||
* // Init with RGB object | ||
* const color = Colors({ r:255, g:23, b: 467 }) | ||
* | ||
* const color = Colors({ r:255, g:23, b: 467 }) | ||
* | ||
* // Init with RGB string | ||
* const color = Colors('rgb(23, 45, 67)) | ||
* const color = Colors('rgba(23, 45, 67, 0.4)) | ||
* | ||
* | ||
* // Init with HSL object | ||
* const color = Colors({ h:255, s:23, l: 467 }) | ||
* | ||
* | ||
* //Conversions | ||
@@ -28,3 +28,3 @@ * color.toHex() | ||
* color.toHSLString() | ||
* | ||
* | ||
* // Verifications | ||
@@ -36,3 +36,3 @@ * color.isHex() | ||
* color.isDark() | ||
* | ||
* | ||
* // Calculations | ||
@@ -45,3 +45,3 @@ * // These functions changes internal initial color. Always prefer using | ||
*/ | ||
var HandleColors = require('./dist/HandleColors'); | ||
var HandleColors = require("./dist/HandleColors"); | ||
@@ -57,2 +57,8 @@ function Colors(color) { | ||
}, | ||
toRGBA: function toRGBA(alpha) { | ||
return { ...RGB, alpha }; | ||
}, | ||
toRGBAString: function toRGBAString(alpha) { | ||
return `rgba(${RGB.red}, ${RGB.green}, ${RGB.blue}, ${alpha} )`; | ||
}, | ||
toRGBString: function toRGBString() { | ||
@@ -81,6 +87,6 @@ return HandleColors.convertRGBObjectToString(RGB); | ||
return HandleColors.isValid(RGB); | ||
} | ||
}, | ||
}; | ||
} | ||
module.exports = Colors; | ||
module.exports = Colors; |
{ | ||
"name": "colors-formater", | ||
"description": "A project to handle colors in javascript", | ||
"version": "0.0.8", | ||
"version": "0.0.9-alpha", | ||
"main": "index.js", | ||
@@ -29,2 +29,2 @@ "repository": { | ||
} | ||
} | ||
} |
57352
1337