stackora-color-gen 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +34 -0
  2. package/index.js +17 -0
  3. package/package.json +17 -0
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # color-gen-pratyush
2
+
3
+ A simple Node.js package to generate random hex color codes.
4
+
5
+ ## Installation
6
+ ```bash
7
+ npm install color-gen-pratyush
8
+ ```
9
+
10
+ ## Usage
11
+ ```javascript
12
+ const colorGen = require('color-gen-pratyush');
13
+
14
+ // Generate a single random color
15
+ const color = colorGen.randomColor();
16
+ console.log(color); // Example: #a72061
17
+
18
+ // Generate an array of random colors
19
+ const colors = colorGen.randomColorArray(5);
20
+ console.log(colors); // Example: ['#7463d1', '#6f7a35', '#ccf450', '#1a2b3c', '#ff00aa']
21
+ ```
22
+
23
+ ## Functions
24
+
25
+ ### randomColor()
26
+ Returns a single random hex color code as a string.
27
+
28
+ ### randomColorArray(count)
29
+ Returns an array of random hex color codes.
30
+ - `count` (optional): Number of colors to generate. Default is 5.
31
+
32
+ ## License
33
+
34
+ ISC
package/index.js ADDED
@@ -0,0 +1,17 @@
1
+ function randomColor() {
2
+ const hex = Math.floor(Math.random() * 16777215).toString(16);
3
+ return '#' + hex.padStart(6, '0');
4
+ }
5
+
6
+ function randomColorArray(count = 5) {
7
+ const colors = [];
8
+ for (let i = 0; i < count; i++) {
9
+ colors.push(randomColor());
10
+ }
11
+ return colors;
12
+ }
13
+
14
+ module.exports = {
15
+ randomColor,
16
+ randomColorArray
17
+ };
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "stackora-color-gen",
3
+ "version": "1.0.0",
4
+ "description": "A simple package to generate random hex color codes",
5
+ "keywords": [
6
+ "color",
7
+ "generator",
8
+ "hex"
9
+ ],
10
+ "license": "ISC",
11
+ "author": "Pratyush kumar",
12
+ "type": "commonjs",
13
+ "main": "index.js",
14
+ "scripts": {
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ }
17
+ }