UNPKG

stylesh

Version:

A powerful and elegant terminal styling library with colors, gradients, borders, themes, and animations for Node.js

45 lines 2.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * String prototype extensions for convenient usage */ const StringStyler_1 = require("../core/StringStyler"); // Extend String prototype String.prototype.color = function (colorName) { return new StringStyler_1.StringStyler(String(this)).color(colorName); }; String.prototype.bg = function (colorName) { return new StringStyler_1.StringStyler(String(this)).bg(colorName); }; String.prototype.gradient = function (colorGroup) { return new StringStyler_1.StringStyler(String(this)).gradient(colorGroup); }; String.prototype.bgGradient = function (colorGroup) { return new StringStyler_1.StringStyler(String(this)).bgGradient(colorGroup); }; // ADD THESE TWO MISSING IMPLEMENTATIONS: String.prototype.theme = function (themeName) { return new StringStyler_1.StringStyler(String(this)).theme(themeName); }; String.prototype.themeBox = function (themeName) { return new StringStyler_1.StringStyler(String(this)).themeBox(themeName); }; String.prototype.createSolidBorder = function (colorName = 'reset', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border('solid', colorName, 'all', alignment); }; String.prototype.createRoundedBorder = function (colorName = 'reset', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border('rounded', colorName, 'all', alignment); }; String.prototype.createDoubleBorder = function (colorName = 'reset', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border('double', colorName, 'all', alignment); }; String.prototype.createDashedBorder = function (colorName = 'reset', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border('dashed', colorName, 'all', alignment); }; String.prototype.createDottedBorder = function (colorName = 'reset', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border('dotted', colorName, 'all', alignment); }; String.prototype.createCustomBorder = function (style = 'solid', colorName = 'reset', direction = 'all', alignment = 'center') { return new StringStyler_1.StringStyler(String(this)).border(style, colorName, direction, alignment); }; //# sourceMappingURL=string.extensions.js.map