UNPKG

@discord-card/core

Version:
49 lines 1.81 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Gradient = void 0; class Gradient { constructor(type, ...colors) { this.type = type; const arr = colors !== null && colors !== void 0 ? colors : []; this.colors = []; for (const stop of arr) { if (typeof stop['offset'] === 'number') { this.colors.push(stop); } else if (typeof stop['off'] === 'number') { this.colors.push({ offset: stop['off'], color: stop['col'], }); } else { this.colors.push({ offset: stop[0], color: stop[1], }); } } } addColorStop(offset, color) { this.colors.push({ offset, color }); } } exports.Gradient = Gradient; __exportStar(require("./Conic"), exports); __exportStar(require("./Linear"), exports); __exportStar(require("./Radial"), exports); //# sourceMappingURL=index.js.map