Skip to content

Commit

Permalink
Use d2h-light-color-scheme for light
Browse files Browse the repository at this point in the history
  • Loading branch information
JHWelch committed Sep 26, 2023
1 parent 987d8cb commit 7410d25
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
26 changes: 13 additions & 13 deletions src/__tests__/diff2html-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('Diff2Html', () => {
it('should generate pretty line by line html from diff', () => {
const result = html(diffExample1, { drawFileList: false });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -262,7 +262,7 @@ describe('Diff2Html', () => {
it('should generate pretty line by line html from json', () => {
const result = html(jsonExample1, { drawFileList: false });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -319,7 +319,7 @@ describe('Diff2Html', () => {
it('should generate pretty diff with files summary', () => {
const result = html(diffExample1, { drawFileList: true });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-file-list-wrapper">
"<div class="d2h-file-list-wrapper d2h-light-color-scheme">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed (1)</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand All @@ -339,7 +339,7 @@ describe('Diff2Html', () => {
</span>
</li>
</ol>
</div><div class="d2h-wrapper">
</div><div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -396,7 +396,7 @@ describe('Diff2Html', () => {
it('should generate pretty side by side html from diff', () => {
const result = html(diffExample1, { outputFormat: OutputFormatType.SIDE_BY_SIDE, drawFileList: false });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -467,7 +467,7 @@ describe('Diff2Html', () => {
it('should generate pretty side by side html from json', () => {
const result = html(jsonExample1, { outputFormat: OutputFormatType.SIDE_BY_SIDE, drawFileList: false });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -538,7 +538,7 @@ describe('Diff2Html', () => {
it('should generate pretty side by side html from diff 2', () => {
const result = html(diffExample1, { outputFormat: OutputFormatType.SIDE_BY_SIDE, drawFileList: true });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-file-list-wrapper">
"<div class="d2h-file-list-wrapper d2h-light-color-scheme">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed (1)</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand All @@ -558,7 +558,7 @@ describe('Diff2Html', () => {
</span>
</li>
</ol>
</div><div class="d2h-wrapper">
</div><div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -652,7 +652,7 @@ describe('Diff2Html', () => {
' \n';
const result = html(diffExample2, { drawFileList: false });
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-211439" class="d2h-file-wrapper" data-lang="md">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -878,7 +878,7 @@ describe('Diff2Html', () => {

const result = html(diff);
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-file-list-wrapper">
"<div class="d2h-file-list-wrapper d2h-light-color-scheme">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed (1)</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand All @@ -898,7 +898,7 @@ describe('Diff2Html', () => {
</span>
</li>
</ol>
</div><div class="d2h-wrapper">
</div><div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-597266" class="d2h-file-wrapper" data-lang="html">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -980,7 +980,7 @@ describe('Diff2Html', () => {
const result = html(diff);
/* eslint-disable no-irregular-whitespace */
expect(result).toMatchInlineSnapshot(`
"<div class="d2h-file-list-wrapper">
"<div class="d2h-file-list-wrapper d2h-light-color-scheme">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed (1)</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand All @@ -1000,7 +1000,7 @@ describe('Diff2Html', () => {
</span>
</li>
</ol>
</div><div class="d2h-wrapper">
</div><div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-719103" class="d2h-file-wrapper" data-lang="js">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/file-list-renderer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('FileListRenderer', () => {
];
const fileHtml = fileListRenderer.render(files);
expect(fileHtml).toMatchInlineSnapshot(`
"<div class="d2h-file-list-wrapper">
"<div class="d2h-file-list-wrapper d2h-light-color-scheme">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed (4)</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/line-by-line-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ describe('LineByLineRenderer', () => {
});
const html = lineByLineRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="txt">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -523,7 +523,7 @@ describe('LineByLineRenderer', () => {
});
const html = lineByLineRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="js">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -583,7 +583,7 @@ describe('LineByLineRenderer', () => {
const lineByLineRenderer = new LineByLineRenderer(hoganUtils);
const html = lineByLineRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="js">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/side-by-side-printer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe('SideBySideRenderer', () => {
const sideBySideRenderer = new SideBySideRenderer(hoganUtils, { matching: LineMatchingType.LINES });
const html = sideBySideRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="txt">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -363,7 +363,7 @@ describe('SideBySideRenderer', () => {
const sideBySideRenderer = new SideBySideRenderer(hoganUtils, {});
const html = sideBySideRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="js">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down Expand Up @@ -434,7 +434,7 @@ describe('SideBySideRenderer', () => {
const sideBySideRenderer = new SideBySideRenderer(hoganUtils);
const html = sideBySideRenderer.render(exampleJson);
expect(html).toMatchInlineSnapshot(`
"<div class="d2h-wrapper">
"<div class="d2h-wrapper d2h-light-color-scheme">
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="js">
<div class="d2h-file-header">
<span class="d2h-file-name-wrapper">
Expand Down
7 changes: 4 additions & 3 deletions src/render-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ export function toCSSClass(lineType: LineType): CSSLineClass {
export function colorSchemeToCss(colorScheme: ColorSchemeType): string {
switch (colorScheme) {
case ColorSchemeType.DARK:
return ' d2h-dark-color-scheme';
return 'd2h-dark-color-scheme';
case ColorSchemeType.AUTO:
return ' d2h-auto-color-scheme';
return 'd2h-auto-color-scheme';
case ColorSchemeType.LIGHT:
default:
return '';
return 'd2h-light-color-scheme';
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/templates/file-summary-wrapper.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d2h-file-list-wrapper{{colorScheme}}">
<div class="d2h-file-list-wrapper {{colorScheme}}">
<div class="d2h-file-list-header">
<span class="d2h-file-list-title">Files changed ({{filesNumber}})</span>
<a class="d2h-file-switch d2h-hide">hide</a>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/generic-wrapper.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="d2h-wrapper{{colorScheme}}">
<div class="d2h-wrapper {{colorScheme}}">
{{{content}}}
</div>

0 comments on commit 7410d25

Please sign in to comment.