UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

165 lines (164 loc) 4.26 kB
// tslint:disable-next-line: no-namespace export var Color; (function (Color) { class HexDto { constructor(color) { /** * Color hex * @default #0000ff */ this.color = "#0000ff"; if (color !== undefined) { this.color = color; } } } Color.HexDto = HexDto; class InvertHexDto { constructor(color) { /** * Color hex * @default #0000ff */ this.color = "#0000ff"; /** * Choose to invert the color to black and white (useful for text color) */ this.blackAndWhite = false; if (color !== undefined) { this.color = color; } } } Color.InvertHexDto = InvertHexDto; class HexDtoMapped { constructor(color, from, to) { /** * Color hex * @default #0000ff */ this.color = "#0000ff"; /** * From min bound * @default 0 * @minimum -Infinity * @maximum Infinity * @step 1 */ this.from = 0; /** * To max bound * @default 255 * @minimum -Infinity * @maximum Infinity * @step 1 */ this.to = 255; if (color !== undefined) { this.color = color; } if (from !== undefined) { this.from = from; } if (to !== undefined) { this.to = to; } } } Color.HexDtoMapped = HexDtoMapped; class RGBObjectMaxDto { constructor(rgb, max) { /** * Min value of the range * @default 0 * @minimum 0 * @maximum 255 * @step 0.1 */ this.min = 0; /** * Max value, it would automatically be remapped to whatever is needed if lower comes in * @default 255 * @minimum 0 * @maximum 255 * @step 0.1 */ this.max = 255; if (rgb !== undefined) { this.rgb = rgb; } if (max !== undefined) { this.max = max; } } } Color.RGBObjectMaxDto = RGBObjectMaxDto; class RGBMinMaxDto { constructor(r, g, b, min, max) { /** * Red value component * @default 255 * @minimum 0 * @maximum 255 * @step 1 */ this.r = 255; /** * Green value component * @default 255 * @minimum 0 * @maximum 255 * @step 1 */ this.g = 255; /** * Blue value component * @default 255 * @minimum 0 * @maximum 255 * @step 1 */ this.b = 255; /** * Min value of the range * @default 0 * @minimum 0 * @maximum 255 * @step 0.1 */ this.min = 0; /** * Max value of the range * @default 255 * @minimum 0 * @maximum 255 * @step 0.1 */ this.max = 255; if (r !== undefined) { this.r = r; } if (g !== undefined) { this.g = g; } if (b !== undefined) { this.b = b; } if (min !== undefined) { this.min = min; } if (max !== undefined) { this.max = max; } } } Color.RGBMinMaxDto = RGBMinMaxDto; class RGBObjectDto { constructor(rgb) { if (rgb !== undefined) { this.rgb = rgb; } } } Color.RGBObjectDto = RGBObjectDto; })(Color || (Color = {}));