Skip to content

Commit 706d004

Browse files
committed
Add clear color to options
1 parent 10464ff commit 706d004

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ The following options may be passed to the `highlight` function.
8484
number: '\x1b[32m', // Numbers
8585
string: '\x1b[32m', // Strings
8686
special: '\x1b[33m', // Special characters
87-
bracket: '\x1b[33m' // Brackets (parentheses)
87+
bracket: '\x1b[33m', // Brackets (parentheses)
88+
clear: '\x1b[0m' // Clear (inserted after each match)
8889
}
8990
```
9091

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const DEFAULT_OPTIONS = {
1111
number: '\x1b[32m',
1212
string: '\x1b[32m',
1313
special: '\x1b[33m',
14-
bracket: '\x1b[33m'
14+
bracket: '\x1b[33m',
15+
clear: '\x1b[0m'
1516
}
1617
}
17-
const clearStyle = '\x1b[0m'
1818

1919
const SPLIT_CHARS = '[^a-zA-Z_]'
2020

@@ -90,10 +90,9 @@ function highlight (sqlString, options) {
9090
} else {
9191
highlighted += options.colors[match.name]
9292
highlighted += stringMatch
93-
highlighted += clearStyle
93+
highlighted += options.colors.clear
9494
}
9595

96-
9796
if (nextMatch) {
9897
highlighted += sqlString.substr(match.start + match.length, nextMatch.start - (match.start + match.length))
9998
}

0 commit comments

Comments
 (0)