Skip to content

Commit

Permalink
make settings background changeable
Browse files Browse the repository at this point in the history
  • Loading branch information
Commander07 committed Jul 31, 2024
1 parent 3d1f04a commit 3a98f42
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "installer"
version = "1.3.1"
version = "1.4.0"
edition = "2021"
build = "build.rs"

Expand Down
1 change: 1 addition & 0 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The Header section contains metadata about the modpack, such as the name, subtit
- `tab_title`: The name of the tab.
- `tab_color`: The background color of the boxes containing the modpack versions. In `#rrbbgg` format.
- `tab_background`: The url of the background image for the tab.
- `settings_background`: The url of the background image for the settings menu.
- `tab_primary_font`: Url to the primary font for the tab.
- `tab_secondary_font`: Url to the secondary font for the tab (subtitle, install/modify/update, uninstall and save buttons).
- `popup_title`: Adds a title to the pre install popup.
Expand Down
16 changes: 15 additions & 1 deletion src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct TabInfo {
color: String,
title: String,
background: String,
settings_background: String,
primary_font: String,
secondary_font: String,
}
Expand Down Expand Up @@ -524,6 +525,12 @@ fn Version(mut props: VersionProps) -> Element {
} else {
String::from("https://raw.githubusercontent.com/Wynncraft-Overhaul/installer/master/src/assets/background_installer.png")
};
let settings_background =
if let Some(ref settings_background) = installer_profile.manifest.settings_background {
settings_background.clone()
} else {
tab_background.clone()
};
let tab_secondary_font = if let Some(ref tab_secondary_font) =
installer_profile.manifest.tab_secondary_font
{
Expand All @@ -545,6 +552,7 @@ fn Version(mut props: VersionProps) -> Element {
color: tab_color,
title: tab_title,
background: tab_background,
settings_background,
primary_font: tab_primary_font,
secondary_font: tab_secondary_font,
},
Expand Down Expand Up @@ -884,7 +892,13 @@ pub(crate) fn app() -> Element {
.replace(
"<BG_IMAGE>",
match pages().get(&page()) {
Some(x) => &x.background,
Some(x) => {
if settings() {
&x.settings_background
} else {
&x.background
}
},
None => "https://raw.githubusercontent.com/Wynncraft-Overhaul/installer/master/src/assets/background_installer.png",
},
).replace("<SECONDARY_FONT>", match pages().get(&page()) {
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ struct Manifest {
tab_background: Option<String>,
tab_primary_font: Option<String>,
tab_secondary_font: Option<String>,
settings_background: Option<String>,
popup_title: Option<String>,
popup_contents: Option<String>,
description: String,
Expand Down

0 comments on commit 3a98f42

Please sign in to comment.