3 const utils = require('./utils');
4 const colors = require('ansi-colors');
15 this._inverse = custom;
18 return this._inverse || utils.inverse(this.primary);
21 set complement(custom) {
22 this._complement = custom;
25 return this._complement || utils.complement(this.primary);
38 success: colors.green,
39 danger: colors.magenta,
41 warning: colors.yellow,
43 disabled: colors.gray,
44 dark: colors.dim.gray,
45 underline: colors.underline,
51 return this._info || this.primary;
58 return this._em || this.primary.underline;
62 this._heading = custom;
65 return this._heading || this.muted.underline;
73 this._pending = custom;
76 return this._pending || this.primary;
79 set submitted(custom) {
80 this._submitted = custom;
83 return this._submitted || this.success;
86 set cancelled(custom) {
87 this._cancelled = custom;
90 return this._cancelled || this.danger;
98 this._typing = custom;
101 return this._typing || this.dim;
104 set placeholder(custom) {
105 this._placeholder = custom;
108 return this._placeholder || this.primary.dim;
111 set highlight(custom) {
112 this._highlight = custom;
115 return this._highlight || this.inverse;
119 styles.merge = (options = {}) => {
120 if (options.styles && typeof options.styles.enabled === 'boolean') {
121 colors.enabled = options.styles.enabled;
123 if (options.styles && typeof options.styles.visible === 'boolean') {
124 colors.visible = options.styles.visible;
127 let result = utils.merge({}, styles, options.styles);
130 for (let key of Object.keys(colors)) {
131 if (!result.hasOwnProperty(key)) {
132 Reflect.defineProperty(result, key, { get: () => colors[key] });
136 for (let key of Object.keys(colors.styles)) {
137 if (!result.hasOwnProperty(key)) {
138 Reflect.defineProperty(result, key, { get: () => colors[key] });
144 module.exports = styles;