First Commit of new way of building the Platform
This commit is contained in:
1 parent
e48cf0dae5
commit
40e60b42cc
4616 files changed
+713402
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
/***
|
||||
* Convert string to hex color.
|
||||
*
|
||||
* @param {String} str Text to hash and convert to hex.
|
||||
* @returns {String}
|
||||
* @api public
|
||||
*/
|
||||
module.exports = function hex(str) {
|
||||
for (
|
||||
var i = 0, hash = 0;
|
||||
i < str.length;
|
||||
hash = str.charCodeAt(i++) + ((hash << 5) - hash)
|
||||
);
|
||||
|
||||
var color = Math.floor(
|
||||
Math.abs(
|
||||
(Math.sin(hash) * 10000) % 1 * 16777216
|
||||
)
|
||||
).toString(16);
|
||||
|
||||
return '#' + Array(6 - color.length + 1).join('0') + color;
|
||||
};
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"text-hex@1.0.0",
|
||||
"C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer"
|
||||
]
|
||||
],
|
||||
"_from": "text-hex@1.0.0",
|
||||
"_id": "text-hex@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==",
|
||||
"_location": "/text-hex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "text-hex@1.0.0",
|
||||
"name": "text-hex",
|
||||
"escapedName": "text-hex",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/colorspace"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer",
|
||||
"author": {
|
||||
"name": "Arnout Kazemier"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/3rd-Eden/text-hex/issues"
|
||||
},
|
||||
"description": "Generate a hex color from the given text",
|
||||
"devDependencies": {
|
||||
"assume": "2.1.x",
|
||||
"mocha": "5.2.x",
|
||||
"pre-commit": "1.2.x"
|
||||
},
|
||||
"homepage": "https://github.com/3rd-Eden/text-hex",
|
||||
"keywords": [
|
||||
"css",
|
||||
"color",
|
||||
"hex",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "text-hex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/3rd-Eden/text-hex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --ui bdd test.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
describe('text-hex', function () {
|
||||
'use strict';
|
||||
|
||||
var assume = require('assume')
|
||||
, hex = require('./');
|
||||
|
||||
it('is a 6 digit hex', function () {
|
||||
assume(hex('a')).to.have.length(7); // including a #
|
||||
assume(hex('a244fdafadfa4 adfau8fa a u adf8a0')).to.have.length(7);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user