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
+29
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var color = require('color')
|
||||
, hex = require('text-hex');
|
||||
|
||||
/**
|
||||
* Generate a color for a given name. But be reasonably smart about it by
|
||||
* understanding name spaces and coloring each namespace a bit lighter so they
|
||||
* still have the same base color as the root.
|
||||
*
|
||||
* @param {string} namespace The namespace
|
||||
* @param {string} [delimiter] The delimiter
|
||||
* @returns {string} color
|
||||
*/
|
||||
module.exports = function colorspace(namespace, delimiter) {
|
||||
var split = namespace.split(delimiter || ':');
|
||||
var base = hex(split[0]);
|
||||
|
||||
if (!split.length) return base;
|
||||
|
||||
for (var i = 0, l = split.length - 1; i < l; i++) {
|
||||
base = color(base)
|
||||
.mix(color(hex(split[i + 1])))
|
||||
.saturate(1)
|
||||
.hex();
|
||||
}
|
||||
|
||||
return base;
|
||||
};
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"colorspace@1.1.2",
|
||||
"C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer"
|
||||
]
|
||||
],
|
||||
"_from": "colorspace@1.1.2",
|
||||
"_id": "colorspace@1.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==",
|
||||
"_location": "/colorspace",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "colorspace@1.1.2",
|
||||
"name": "colorspace",
|
||||
"escapedName": "colorspace",
|
||||
"rawSpec": "1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/diagnostics"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz",
|
||||
"_spec": "1.1.2",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer",
|
||||
"author": {
|
||||
"name": "Arnout Kazemier"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/3rd-Eden/colorspace/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"color": "3.0.x",
|
||||
"text-hex": "1.0.x"
|
||||
},
|
||||
"description": "Generate HEX colors for a given namespace.",
|
||||
"devDependencies": {
|
||||
"assume": "2.1.x",
|
||||
"mocha": "5.2.x",
|
||||
"pre-commit": "1.2.x"
|
||||
},
|
||||
"homepage": "https://github.com/3rd-Eden/colorspace",
|
||||
"keywords": [
|
||||
"namespace",
|
||||
"color",
|
||||
"hex",
|
||||
"colorize",
|
||||
"name",
|
||||
"space",
|
||||
"colorspace"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "colorspace",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/3rd-Eden/colorspace.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
describe('colorspace', function () {
|
||||
var colorspace = require('./');
|
||||
var assume = require('assume');
|
||||
|
||||
it('returns a consistent color for a given name', function () {
|
||||
assume(colorspace('bigpipe')).equals('#20f95a');
|
||||
assume(colorspace('bigpipe')).equals('#20f95a');
|
||||
assume(colorspace('bigpipe')).equals('#20f95a');
|
||||
});
|
||||
|
||||
it('tones the color when namespaced by a : char', function () {
|
||||
assume(colorspace('bigpipe:pagelet')).equals('#00FF2C');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user