Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
fix(#2): fixed a bug with theme loading
Browse files Browse the repository at this point in the history
  • Loading branch information
celedev97 committed Nov 22, 2023
1 parent 66b1f42 commit 4c72eac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/dev/cele/asa_sm/dto/SettingsDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
@Data
@NoArgsConstructor
public class SettingsDto {
private String theme = "/dev/cele/asa_sm/themes/nord.theme.json";
private String theme = "classpath:/dev/cele/asa_sm/themes/nord.theme.json";
}
8 changes: 7 additions & 1 deletion src/main/java/dev/cele/asa_sm/services/SettingsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ public void loadTheme(){
IntelliJTheme.setup(AsaSmApplication.class.getResourceAsStream(themePath));
}else{
//load theme from file
IntelliJTheme.setup(new FileInputStream(Const.THEME_DIR.resolve(settings.getTheme()).toFile()));
try {
IntelliJTheme.setup(new FileInputStream(Const.THEME_DIR.resolve(settings.getTheme()).toFile()));
} catch (Exception e) {
log.error("Error loading theme, falling back to default theme", e);
settings.setTheme(new SettingsDto().getTheme());
save();
}
}

FlatLaf.updateUI();
Expand Down

0 comments on commit 4c72eac

Please sign in to comment.