Skip to content

Commit

Permalink
Set default text color as terminal color
Browse files Browse the repository at this point in the history
Instead of using chalk.white
jbcarpanelli committed Jun 16, 2019
1 parent 38ee3e5 commit 2da89d8
Showing 3 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ class Spinnies {
constructor(options = {}) {
options = purgeSpinnersOptions(options);
this.options = {
color: 'white',
spinnerColor: 'greenBright',
succeedColor: 'green',
failColor: 'red',
@@ -132,11 +131,11 @@ class Spinnies {
.values(this.spinners)
.map(({ text, status, color, spinnerColor, succeedColor, failColor, succeedPrefix, failPrefix }) => {
let line;
let prefixLength = 2;
let prefixLength;
if (status === 'spinning') {
prefixLength = frame.length + 1;
text = breakText(text, prefixLength);
line = `${chalk[spinnerColor](frame)} ${chalk[color](text)}`;
line = `${chalk[spinnerColor](frame)} ${color ? chalk[color](text) : text}`;
} else {
if (hasActiveSpinners) text = breakText(text, prefixLength);
if (status === 'succeed') {
@@ -146,7 +145,7 @@ class Spinnies {
prefixLength = failPrefix.length + 1;
line = `${chalk.red(failPrefix)} ${chalk[failColor](text)}`;
} else {
line = `- ${chalk[color](text)}`;
line = text;
}
}
linesLength.push(...getLinesLength(text, prefixLength));
2 changes: 1 addition & 1 deletion test/behaviours.test.js
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ function expectToBehaveLikeAnUpdate(self, status) {
it('mantains the previous options', () => {
const options = { text: 42, color: 'foo', spinnerColor: 'bar' };
const spinner = self.spinners[currentStatus]('spinner', options);
expect(spinner).to.include({ text: 'spinner', color: 'white', spinnerColor: 'greenBright' });
expect(spinner).to.include({ text: 'spinner', spinnerColor: 'greenBright' });
});
});

1 change: 0 additions & 1 deletion test/spinners.test.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ describe('Spinnies', () => {
beforeEach('initialize', () => {
this.spinners = new Spinnies();
this.spinnersOptions = {
color: 'white',
succeedColor: 'green',
failColor: 'red',
spinnerColor: 'greenBright',

0 comments on commit 2da89d8

Please sign in to comment.