Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function color_(color, _) {
let f;
if (isFunction(color)) {
f = obj => rgb(color(obj, _));
f.dep = dependency(color);
} else {
// default to mid-grey
f = constant(rgb(color || '#888'));
}
return f;
}
.on('parsed', function () {
console.log(name);
colors[key] = colorgram.extract({
data: this.data,
width: this.width,
height: this.height,
channels: 4
}, bgColor ? (COLORS - 1) : COLORS);
if (bgColor) {
var r = d3Color.rgb(bgColor);
colors[key].push([r.r, r.g, r.b, 1]);
}
colors[key].forEach(function (c) {
c.pop();
var n = d3Color.rgb(c[0], c[1], c[2], 1);
var h = d3Color.cubehelix(n);
h.s = Math.max(h.s, 1);
h.l = Math.max(h.l, 0.8);
h.l = Math.min(h.l, 1.2);
c[0] = h.h;
c[1] = h.s;
c[2] = h.l;
});
.range([red, amber, green, grey.darker()]);
export const authoritativeRatingBackgroundColorScale = scaleOrdinal()
.domain(["DISCOURAGED", "SECONDARY", "PRIMARY", "NO_OPINION"])
.range([redBg, amberBg, greenBg, greyBg]);
export const environmentColorScale = scaleOrdinal()
.domain(["DEV", "PREPROD", "PROD", "QA", "UAT", "DR"])
.range([green, amber, gold, purple, pink, blue]);
export const operatingSystemColorScale = scaleOrdinal()
.domain(["Windows", "Linux", "AS/400", "OS/390", "AIX", "Solaris"])
.range([blue, green, rgb("#777"), rgb("#555"), rgb("#473"), amber]);
export const lifecyclePhaseColorScale = scaleOrdinal()
.domain(["PRODUCTION", "CONCEPTUAL", "DEVELOPMENT", "RETIRED"])
.range([gold, blue, green, grey]);
export const attestationStatusColorScale = scaleOrdinal()
.domain(["ATTESTED", "NEVER_ATTESTED"])
.range([green, grey]);
export const criticalityColorScale = scaleOrdinal()
.domain(["LOW", "MEDIUM", "HIGH", "VERY_HIGH", "NONE", "UNKNOWN"])
.range([green, amber, red, red.darker(), grey, grey.darker()]);
return datum =>
modifiers
.reduce((color, modify) => modify(color), rgb(getColor(datum)))
.toString()
}
.addPropFunctor('stroke', function (d, i) {
return rgb($$.fill.call(this, d, i)).darker(0.3);
})
.addPropFunctor('strokeWidth', '1px');
function verifyColorsAlmostEqual(color1: string, color2: string, maxDistance = 1) {
const rgb1 = d3.rgb(color1);
const rgb2 = d3.rgb(color2);
expect(Math.sqrt(Math.pow(rgb1.r - rgb2.r, 2)
+ Math.pow(rgb1.g - rgb2.g, 2)
+ Math.pow(rgb1.b - rgb2.b, 2)))
.toBeLessThanOrEqual(maxDistance);
}
const toVectorColor = colorStr => {
const _rgb = rgb(colorStr);
return [_rgb.r / 255, _rgb.g / 255, _rgb.b / 255];
};
function hsv2rgb(r1, g1, b1, m, a) {
return rgb((r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255, a);
}
e.on("change", function (w) {
if (idx === 0) {
context._inputElement[1].property("value", d3Rgb(context._inputElement[0].property("value")).toString());
context.value(context._inputElement[0].property("value"));
} else {
context._inputElement[0].property("value", context._inputElement[1].property("value"));
context.value(d3Rgb(context._inputElement[1].property("value")).toString());
}
w.change(w, true);
});
});
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific
*
*/
import {rgb} from "d3-color";
import {scaleOrdinal, schemeCategory20c} from "d3-scale";
import _ from "lodash";
export const black = rgb("#000");
export const amber = rgb("#D9923F");
export const green = rgb("#5BB65D");
export const red = rgb("#DA524B");
export const pink = rgb("#ffcffc");
export const grey = rgb("#939393");
export const lightGrey = rgb("#d1d1d1");
export const blue = rgb("#5271CC");
export const purple= rgb("#B687CC");
export const gold = rgb("#b7b04e");
export const actor = rgb("#d7bbdb");
export const amberBg = rgb("#FCF2D7");
export const greenBg = rgb("#DFF1D2");
export const redBg = rgb("#F2D7D7");
export const greyBg = rgb("#F5F5F5");
export const actorBg = rgb("#ede5ee");