Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Added customizable background image #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ To change the default name, the greetings and if you want to have an image backg
// General
name: 'John',
imageBackground: false,
imageUrl: './assets/background.jpg', // Set custom background image URL. If the page is served insecurely, you may have issues loading images from pages over https.
openInNewTab: true,

// Greetings
Expand All @@ -94,7 +95,7 @@ To change the default name, the greetings and if you want to have an image backg

```

> You can change the background by substituting the `background.jpg` file in `assets` folder.
> You can change the background by providing a link to an image in `config.js`.

![](assets/img/backgroundImage.png)

Expand Down
1 change: 0 additions & 1 deletion app.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
--cards: #e4e6e6; /* Cards color */

/* Image background */
--imgbg: url(assets/background.jpg); /* Image URL */
--imgcol: linear-gradient(
rgba(255, 255, 255, 0.7),
rgba(255, 255, 255, 0.7)
Expand Down
2 changes: 2 additions & 0 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ themeToggle.addEventListener('click', () => {
});

if (CONFIG.imageBackground) {
const root = document.querySelector(':root');
root.style.setProperty('--imgbg', `url(${CONFIG.imageUrl})`);
document.body.classList.add('withImageBackground');
}

Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const CONFIG = {
// General
name: 'John',
imageBackground: false,
imageUrl: './assets/background.jpg', // Set custom background image URL. If the page is served insecurely, you may have issues loading images from pages over https.
openInNewTab: true,
twelveHourFormat: false,

Expand Down