UNPKG

malwoden

Version:

![alt text](./coverage/badge-lines.svg) ![alt text](./coverage/badge-statements.svg) ![alt text](./coverage/badge-functions.svg) ![alt text](./coverage/badge-branches.svg)

191 lines 8.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Color = void 0; var Color = /** @class */ (function () { function Color(r, g, b) { this.r = r; this.g = g; this.b = b; } Color.prototype.isEqual = function (color) { return this.r === color.r && this.g === color.g && this.b === color.b; }; Color.prototype.cssColor = function () { return "rgb(" + this.r + "," + this.g + "," + this.b + ")"; }; Color.prototype.sanitizeElement = function (rgb) { return Math.round(Math.min(Math.max(rgb, 0), 255)); }; Color.prototype.add = function (other, fractionOther) { if (fractionOther === void 0) { fractionOther = 1; } return new Color(this.sanitizeElement(this.r + other.r * fractionOther), this.sanitizeElement(this.g + other.g * fractionOther), this.sanitizeElement(this.b + other.b * fractionOther)); }; Color.prototype.blend = function (other, fractionOther) { if (fractionOther === void 0) { fractionOther = 0.5; } var fractionThis = 1.0 - fractionOther; return new Color(this.sanitizeElement(this.r * fractionThis + other.r * fractionOther), this.sanitizeElement(this.g * fractionThis + other.g * fractionOther), this.sanitizeElement(this.b * fractionThis + other.b * fractionOther)); }; Color.prototype.blendPercent = function (other, percentOther) { return this.blend(other, percentOther / 100); }; Color.prototype.toGrayscale = function () { var total = this.r + this.g + this.b; return new Color(this.sanitizeElement(total / 3), this.sanitizeElement(total / 3), this.sanitizeElement(total / 3)); }; // CSS Extended Color Palette // https://en.wikipedia.org/wiki/Web_colors // Pink Colors Color.MediumVioletRed = new Color(199, 21, 133); Color.DeepPink = new Color(255, 20, 147); Color.PaleVioletRed = new Color(219, 112, 147); Color.HotPink = new Color(255, 105, 180); Color.LightPink = new Color(255, 182, 193); Color.Pink = new Color(255, 192, 203); // Red Colors Color.DarkRed = new Color(139, 0, 0); Color.Red = new Color(255, 0, 0); Color.Firebrick = new Color(178, 34, 34); Color.Crimson = new Color(220, 20, 60); Color.IndianRed = new Color(205, 92, 92); Color.LightCoral = new Color(240, 128, 128); Color.Salmon = new Color(250, 128, 114); Color.DarkSalmon = new Color(233, 150, 122); Color.LightSalmon = new Color(255, 160, 122); // Orange Colors Color.OrangeRed = new Color(255, 69, 0); Color.Tomato = new Color(255, 99, 71); Color.DarkOrange = new Color(255, 140, 0); Color.Coral = new Color(255, 127, 80); Color.Orange = new Color(255, 165, 0); // Yellow Colors Color.DarkKhaki = new Color(189, 183, 107); Color.Gold = new Color(255, 215, 0); Color.Khaki = new Color(240, 230, 140); Color.PeachPuff = new Color(255, 218, 185); Color.Yellow = new Color(255, 255, 0); Color.PaleGoldenrod = new Color(238, 232, 170); Color.Moccasin = new Color(255, 228, 181); Color.PapayaWhip = new Color(255, 239, 213); Color.LightGoldenrodYellow = new Color(250, 250, 210); Color.LemonChiffon = new Color(255, 250, 205); Color.LightYellow = new Color(255, 255, 224); // Brown Colors Color.Maroon = new Color(128, 0, 0); Color.Brown = new Color(165, 42, 42); Color.SaddleBrown = new Color(139, 69, 19); Color.Sienna = new Color(160, 82, 45); Color.Chocolate = new Color(210, 105, 30); Color.DarkGoldenrod = new Color(184, 134, 11); Color.Peru = new Color(205, 133, 63); Color.RosyBrown = new Color(188, 143, 143); Color.Goldenrod = new Color(218, 165, 32); Color.SandyBrown = new Color(244, 164, 96); Color.Tan = new Color(210, 180, 140); Color.Burlywood = new Color(222, 184, 135); Color.Wheat = new Color(245, 222, 179); Color.NavajoWhite = new Color(255, 222, 173); Color.Bisque = new Color(255, 228, 196); Color.BlanchedAlmond = new Color(255, 235, 205); Color.Cornsilk = new Color(255, 248, 220); // Purple/Violet/Magenta Colors Color.Indigo = new Color(75, 0, 130); Color.Purple = new Color(128, 0, 128); Color.DarkMagenta = new Color(139, 9, 139); Color.DarkViolet = new Color(148, 0, 211); Color.DarkSlateBlue = new Color(72, 61, 129); Color.BlueViolet = new Color(138, 43, 226); Color.DarkOrchid = new Color(153, 50, 204); Color.Fuchsia = new Color(255, 0, 255); Color.Magenta = new Color(255, 0, 255); // Alias Fuchsia Color.SlateBlue = new Color(106, 90, 205); Color.MediumSlateBlue = new Color(123, 104, 238); Color.MediumOrchid = new Color(186, 85, 211); Color.MediumPurple = new Color(147, 112, 219); Color.Orchid = new Color(218, 11, 214); Color.Violet = new Color(238, 130, 238); Color.Plum = new Color(221, 160, 221); Color.Thistle = new Color(216, 191, 216); Color.Lavender = new Color(230, 230, 250); // White Colors Color.MistyRose = new Color(255, 228, 225); Color.AntiqueWhite = new Color(250, 235, 215); Color.Linen = new Color(250, 240, 230); Color.Beige = new Color(245, 245, 220); Color.WhiteSmoke = new Color(245, 245, 245); Color.LavenderBlush = new Color(255, 240, 245); Color.OldLace = new Color(253, 245, 230); Color.AliceBlue = new Color(240, 248, 255); Color.Seashell = new Color(255, 245, 238); Color.GhostWhite = new Color(248, 248, 255); Color.Honeydew = new Color(240, 255, 240); Color.FloralWhite = new Color(255, 250, 240); Color.Azure = new Color(240, 255, 255); Color.MintCream = new Color(245, 255, 250); Color.Snow = new Color(255, 250, 250); Color.Ivory = new Color(255, 255, 240); Color.White = new Color(255, 255, 255); // Grey + Black Colors Color.Black = new Color(0, 0, 0); Color.DarkSlateGray = new Color(47, 79, 79); Color.DimGray = new Color(105, 105, 105); Color.SlateGray = new Color(112, 128, 144); Color.Gray = new Color(128, 128, 128); Color.LightSlateGray = new Color(119, 136, 153); Color.DarkGray = new Color(169, 169, 169); Color.Silver = new Color(192, 192, 192); Color.LightGray = new Color(211, 211, 211); Color.Gainsboro = new Color(220, 220, 220); // Green Colors Color.DarkGreen = new Color(0, 100, 0); Color.Green = new Color(0, 128, 0); Color.DarkOliveGreen = new Color(85, 107, 47); Color.ForestGreen = new Color(34, 139, 34); Color.SeaGreen = new Color(46, 139, 87); Color.Olive = new Color(128, 128, 0); Color.OliveDrab = new Color(107, 142, 35); Color.MediumSeaGreen = new Color(60, 179, 113); Color.LimeGreen = new Color(50, 205, 50); Color.Lime = new Color(0, 255, 0); Color.SpringGreen = new Color(0, 255, 127); Color.MediumSpringGreen = new Color(0, 250, 154); Color.DarkSeaGreen = new Color(143, 188, 143); Color.MediumAquamarine = new Color(102, 205, 170); Color.YellowGreen = new Color(154, 205, 50); Color.LawnGreen = new Color(124, 252, 0); Color.Chartreuse = new Color(127, 255, 0); Color.LightGreen = new Color(133, 238, 144); Color.GreenYellow = new Color(173, 255, 47); Color.PaleGreen = new Color(152, 251, 152); // Cyan Colors Color.Teal = new Color(0, 128, 128); Color.DarkCyan = new Color(0, 139, 139); Color.LightSeaGreen = new Color(32, 178, 170); Color.CadetBlue = new Color(95, 158, 160); Color.DarkTurquoise = new Color(0, 206, 209); Color.MediumTurquoise = new Color(72, 209, 204); Color.Turquoise = new Color(64, 224, 208); Color.Aqua = new Color(0, 255, 255); Color.Cyan = new Color(0, 255, 255); Color.Aquamarine = new Color(127, 255, 212); Color.PaleTurquoise = new Color(175, 238, 238); Color.LightCyan = new Color(244, 255, 255); // Blue Colors Color.Navy = new Color(0, 0, 128); Color.DarkBlue = new Color(0, 0, 139); Color.MediumBlue = new Color(0, 0, 205); Color.Blue = new Color(0, 0, 225); Color.MidnightBlue = new Color(25, 25, 112); Color.RoyalBlue = new Color(65, 105, 225); Color.SteelBlue = new Color(70, 130, 180); Color.DodgerBlue = new Color(30, 144, 255); Color.DeepSkyBlue = new Color(0, 191, 255); Color.CornflowerBlue = new Color(100, 149, 237); Color.SkyBlue = new Color(135, 206, 235); Color.LightSkyBlue = new Color(135, 206, 250); Color.LightSteelBlue = new Color(176, 196, 222); Color.LightBlue = new Color(173, 216, 230); Color.PowderBlue = new Color(176, 224, 230); return Color; }()); exports.Color = Color; //# sourceMappingURL=color.js.map