Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix(renderer): change background
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghongtu committed May 16, 2019
1 parent 4c99e96 commit 85206b6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/renderer/utils/changeBackground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ export default ({ isStart, enable, url }: IChangeBackground) => {
if (isStart) {
enable = settings.get(ENABLE_BACKGROUND_IMAGE, true);
}
if (enable && !url) {
url = settings.get(BACKGROUND_IMAGE_URL, DEFAULT_BACKGROUND_IMAGE);
}

let background: string;

enable ? (background = `url(${url})`) : (background = 'none');
if (enable) {
if (!url) {
url = settings.get(BACKGROUND_IMAGE_URL, DEFAULT_BACKGROUND_IMAGE);
}

document.body.style.cssText = `background:${background};background-size:100vw 100vh;`;
const background = `url(${url})`;
document.body.style.cssText = `background:${background};background-size:100vw 100vh;`;
} else {
const background = 'none';
document.body.style.cssText = `background:${background};`;
}
};

0 comments on commit 85206b6

Please sign in to comment.