Reverses application of styles, now left-to-right
The styles' application order used to to be right-to-left e.g.:
```javascript
console.log(chalk.red.reset.blue('something'))
// red
```
Where now it has been reversed. E.g.:
```javascript
console.log(chalk.red.reset.blue('something'))
// blue
```
It seems to me that this is the more intuitive application order.
Closes #41
This commit is contained in:
parent
bc4f81d352
commit
0234fe987d
2 changed files with 6 additions and 5 deletions
3
index.js
3
index.js
|
|
@ -57,7 +57,8 @@ function applyStyle() {
|
|||
/*jshint validthis: true*/
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
for (var i = 0; i < nestedStyles.length; i++) {
|
||||
var i = nestedStyles.length;
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue