diff options
| author | cyanos3 <[email protected]> | 2013-11-05 07:43:27 -0700 |
|---|---|---|
| committer | cyanos3 <[email protected]> | 2013-11-05 07:43:27 -0700 |
| commit | 86e3fee620f4182bd3966b2b3743cdd652d4bc0f (patch) | |
| tree | f5e32a279e428cfc5a401854e8eae54a0cd4b073 /lib | |
| parent | 7f825fb253457f1877e3d20f252e736b903eefa2 (diff) | |
| download | faker-86e3fee620f4182bd3966b2b3743cdd652d4bc0f.tar.xz faker-86e3fee620f4182bd3966b2b3743cdd652d4bc0f.zip | |
Add random color to Internet.js
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/internet.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/internet.js b/lib/internet.js index 898769de..353a362a 100644 --- a/lib/internet.js +++ b/lib/internet.js @@ -37,6 +37,16 @@ var internet = { } return result.join("."); + }, + + color: function (baseRed255, baseGreen255, baseBlue255) { + + // based on awesome response : http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette + var red = Math.floor((Faker.random.number(256) + baseRed255) / 2); + var green = Math.floor((Faker.random.number(256) + baseRed255) / 2); + var blue = Math.floor((Faker.random.number(256) + baseRed255) / 2); + + return '#' + red.toString(16) + green.toString(16) + blue.toString(16); } }; |
