Switch Snark dark and light themes to using images embedded in the .war, and remove the images substitutions from the filesystem and css

This commit is contained in:
hankhill19580
2020-10-07 04:47:27 +00:00
parent 2e34969bbc
commit ca1e2ba91e
46 changed files with 23 additions and 161 deletions

View File

@ -881,6 +881,28 @@ public class SnarkManager implements CompleteListener, ClientApp {
}
return theme;
}
/**
* Get the path to the preferred embedded icons for toImg, "solid/" for
* dark and light, "" for everything else.
*
* If you add a theme with a new icon set, then you need to add a
* corresponding condition here.
*
* @return String "solid/" or ""
* @since 0.9.48
*/
public String getThemeIconSet() {
String iconset = "";
if (_log.shouldLog(Log.DEBUG))
_log.debug("Theme was: " + this.getTheme());
if (this.getTheme().equals("dark") || this.getTheme().equals("light")) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Using solid iconset.");
iconset = "solid/";
}
return iconset;
}
/**
* Get all themes

View File

@ -4206,7 +4206,7 @@ public class I2PSnarkServlet extends BasicServlet {
* @since 0.8.2
*/
private String toImg(String icon, String altText) {
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + icon + ".png\">";
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + _manager.getThemeIconSet() + icon + ".png\">";
}
/**