forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from AY2324S2-CS2103T-W08-3/light-theme
Added Light theme
- Loading branch information
Showing
19 changed files
with
384 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package scm.address.model.theme; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
|
||
/** | ||
* Represents the Dark Theme of the application. | ||
*/ | ||
class DarkTheme implements Theme { | ||
private static final String DARK_THEME_NAME = "dark"; | ||
private static final String DARK_THEME_CSS_PATH = "/view/DarkTheme.css"; | ||
private static final String DARK_THEME_EXTENSIONS_CSS_PATH = "/view/Extensions.css"; | ||
@JsonProperty | ||
private String theme = "dark"; | ||
|
||
@Override | ||
public String getThemeName() { | ||
return DARK_THEME_NAME; | ||
} | ||
|
||
@Override | ||
public String getThemeCssPath() { | ||
return DARK_THEME_CSS_PATH; | ||
} | ||
|
||
@Override | ||
public String getThemeExtensionsCssPath() { | ||
return DARK_THEME_EXTENSIONS_CSS_PATH; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof DarkTheme; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package scm.address.model.theme; | ||
|
||
/** | ||
* Represents the Light Theme of the application. | ||
*/ | ||
class LightTheme implements Theme { | ||
private static final String LIGHT_THEME_NAME = "light"; | ||
private static final String LIGHT_THEME_CSS_PATH = "/view/LightTheme.css"; | ||
private static final String LIGHT_THEME_EXTENSIONS_CSS_PATH = "/view/Extensions.css"; | ||
|
||
|
||
@Override | ||
public String getThemeName() { | ||
return LIGHT_THEME_NAME; | ||
} | ||
|
||
@Override | ||
public String getThemeCssPath() { | ||
return LIGHT_THEME_CSS_PATH; | ||
} | ||
|
||
@Override | ||
public String getThemeExtensionsCssPath() { | ||
return LIGHT_THEME_EXTENSIONS_CSS_PATH; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof LightTheme; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package scm.address.model.theme; | ||
|
||
/** | ||
* Represents a Theme in the application. | ||
*/ | ||
public interface Theme { | ||
String getThemeName(); | ||
String getThemeCssPath(); | ||
String getThemeExtensionsCssPath(); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/scm/address/model/theme/ThemeCollection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package scm.address.model.theme; | ||
|
||
/** | ||
* Contains the collection of themes available in the application. | ||
*/ | ||
public class ThemeCollection { | ||
public static final String MESSAGE_INVALID_THEME_NAME = "Invalid theme name provided."; | ||
private static final Theme darkTheme = new DarkTheme(); | ||
private static final Theme lightTheme = new LightTheme(); | ||
|
||
public static Theme getDarkTheme() { | ||
return darkTheme; | ||
} | ||
|
||
public static Theme getLightTheme() { | ||
return lightTheme; | ||
} | ||
|
||
public static Theme getTheme(String themeName) throws IllegalArgumentException { | ||
String temp = themeName.toLowerCase(); | ||
|
||
if (temp.equals(darkTheme.getThemeName())) { | ||
return darkTheme; | ||
} else if (temp.equals(lightTheme.getThemeName())) { | ||
return lightTheme; | ||
} else { | ||
throw new IllegalArgumentException(MESSAGE_INVALID_THEME_NAME); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.