niledatabase
Version:
Command line interface for Nile databases
78 lines (77 loc) • 3.26 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.table = exports.theme = void 0;
exports.formatCommand = formatCommand;
exports.formatUrl = formatUrl;
exports.formatStatus = formatStatus;
const chalk_1 = __importDefault(require("chalk"));
exports.theme = {
// Primary colors for main actions and headings
primary: chalk_1.default.hex('#FF6B35'), // Deep orange - more vibrant main brand color
// Status colors
success: chalk_1.default.hex('#00A676'), // Deep teal - richer green
warning: chalk_1.default.hex('#FFB800'), // Rich amber - more visible warning
error: chalk_1.default.hex('#FF4365'), // Deep rose - stronger red
// Information and secondary content
info: chalk_1.default.hex('#7B61FF'), // Rich purple - more vibrant
secondary: chalk_1.default.hex('#64748B'), // Dark slate - deeper neutral
// Highlights and accents
highlight: chalk_1.default.hex('#FF6B35'), // Deep orange - matching primary
accent: chalk_1.default.hex('#0EA5E9'), // Electric blue - more vibrant
// Specific use cases
command: chalk_1.default.hex('#FF6B35'), // Deep orange for commands
param: chalk_1.default.hex('#7B61FF'), // Rich purple for parameters
url: chalk_1.default.hex('#0EA5E9'), // Electric blue for URLs
// Table formatting
header: chalk_1.default.bold.hex('#FF6B35'), // Deep orange headers
border: chalk_1.default.hex('#64748B'), // Dark slate borders
// Dim text for less important information
dim: chalk_1.default.hex('#64748B').dim,
// Formatting helpers
bold: chalk_1.default.bold,
underline: chalk_1.default.underline,
// Status indicators
active: chalk_1.default.hex('#00A676'), // Deep teal for active/running
inactive: chalk_1.default.hex('#64748B'), // Dark slate for inactive/stopped
pending: chalk_1.default.hex('#FFB800'), // Rich amber for pending/processing
};
// Helper function for table borders
exports.table = {
topLeft: exports.theme.border('┌'),
topRight: exports.theme.border('┐'),
bottomLeft: exports.theme.border('└'),
bottomRight: exports.theme.border('┘'),
vertical: exports.theme.border('│'),
horizontal: exports.theme.border('─'),
cross: exports.theme.border('┼'),
};
// Helper function for command examples
function formatCommand(command, args) {
return `${exports.theme.command('$')} ${exports.theme.command(command)}${args ? ' ' + exports.theme.param(args) : ''}`;
}
// Helper function for URLs
function formatUrl(url) {
return exports.theme.url(url);
}
// Helper function for status
function formatStatus(status) {
switch (status.toLowerCase()) {
case 'active':
case 'running':
case 'success':
return exports.theme.active(status);
case 'inactive':
case 'stopped':
case 'failed':
return exports.theme.inactive(status);
case 'pending':
case 'creating':
case 'updating':
return exports.theme.pending(status);
default:
return exports.theme.secondary(status);
}
}