Skip to content

Commit

Permalink
Merge pull request #44 from rburns/feature-faint-text
Browse files Browse the repository at this point in the history
render faint text using css brightness filter
  • Loading branch information
rburns committed Oct 20, 2018
2 parents b4093d1 + 43ed048 commit 0d9149a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ansi_to_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function handleDisplay(stack, code, options) {
'-1': () => '<br/>',
0: () => stack.length && resetStyles(stack),
1: () => pushTag(stack, 'b'),
2: () => pushStyle(stack, 'filter:brightness(0.7)'),
3: () => pushTag(stack, 'i'),
4: () => pushTag(stack, 'u'),
8: () => pushStyle(stack, 'display:none'),
Expand Down
9 changes: 8 additions & 1 deletion test/ansi_to_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ describe('ansi to html', function () {
return test(text, result, done);
});

it('renders faint text', function(done) {
const text = 'faint: \x1b[2mstuff';
const result = 'faint: <span style="filter:brightness(0.7)">stuff</span>';

return test(text, result, done);
});

it('handles resets', function (done) {
const text = '\x1b[1mthis is bold\x1b[0m, but this isn\'t';
const result = '<b>this is bold</b>, but this isn\'t';
Expand Down Expand Up @@ -287,7 +294,7 @@ describe('ansi to html', function () {

return test(text, result, done);
});

it('renders overline', function (done) {
const text = '\x1b[53mHello World';
const result = '<span style="text-decoration:overline">Hello World</span>';
Expand Down

0 comments on commit 0d9149a

Please sign in to comment.