Skip to content

Commit

Permalink
Merge pull request #92 from einaskoi/einar/backgroundStyle
Browse files Browse the repository at this point in the history
Change background images to gradients and remove redudant code
  • Loading branch information
peretr authored May 13, 2026
2 parents 2430c27 + d02b79f commit de2f531
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,7 @@ public BorderPane getRoot() {
root.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
root.getStylesheets().add(getClass().getResource("/css/desktop.css").toExternalForm());
root.getStylesheets().add(getClass().getResource("/css/apps.css").toExternalForm());

Image backgroundImage = new Image(
Objects.requireNonNull(getClass().getResourceAsStream("/Images/mac_home_background.jpg")),
1920, 1080,
true, // preserve aspect ratio
true // smooth scaling
);

// Configure background to cover the full container without tiling
BackgroundSize backgroundSize = new BackgroundSize(
BackgroundSize.AUTO, BackgroundSize.AUTO,
false,
false,
false,
true
);

BackgroundImage background = new BackgroundImage(
backgroundImage,
BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT,
BackgroundPosition.CENTER,
backgroundSize
);

root.setBackground(new Background(background));
root.getStyleClass().add("desktop-root");

return root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ public class StartView {
public StackPane getRoot() {
StackPane root = new StackPane();

// Background image
Image backgroundImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/Images/windows7_login_background.jpg")), 1920, 1080, true, true);
BackgroundImage background = new BackgroundImage(
backgroundImage,
BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT,
BackgroundPosition.CENTER,
new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, false, false, true, true)
);
root.setBackground(new Background(background));

// User input content
VBox loginContainer = new VBox(20);
loginContainer.setAlignment(Pos.CENTER);
Expand Down
Binary file removed src/main/resources/Images/mac_home_background.jpg
Binary file not shown.
Binary file not shown.
Binary file added src/main/resources/Sounds/mouse_click.wav
Binary file not shown.
4 changes: 4 additions & 0 deletions src/main/resources/css/desktop.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.desktop-root {
-fx-background-color: linear-gradient(#263B6A, #6984A9);
}

.desktop-bottom-bar {
-fx-background-color: rgba(0, 0, 0, 0.7);
-fx-background-radius: 0;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/css/login.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.login-root {
-fx-font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
-fx-background-color: linear-gradient(#FF9D23, #EA5252);
}

.login-container {
Expand Down

0 comments on commit de2f531

Please sign in to comment.