Skip to content
Snippets Groups Projects
Commit 3442b865 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed default icon color for templates

parent e625c4f5
No related branches found
No related tags found
No related merge requests found
......@@ -163,6 +163,12 @@ public class Account implements ProvidesID, Iconizable
return fontColor;
}
@Override
public String getDefaultFontColor(boolean isDarkTheme)
{
return ACCOUNT_FONT_COLOR;
}
@Override
public String toString()
{
......
......@@ -17,6 +17,9 @@ import java.util.Objects;
@Entity
public class Category implements ProvidesID, Iconizable
{
private static final String FONT_COLOR_LIGHT_THEME = "#212121";
private static final String FONT_COLOR_DARK_THEME = "#FFFFFF";
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Expose
......@@ -127,6 +130,17 @@ public class Category implements ProvidesID, Iconizable
return fontColor;
}
@Override
public String getDefaultFontColor(boolean isDarkTheme)
{
if(isDarkTheme)
{
return FONT_COLOR_DARK_THEME;
}
return FONT_COLOR_LIGHT_THEME;
}
public String getAppropriateTextColor()
{
return ColorUtilsNonJavaFX.getAppropriateTextColor(new Color(color)).toRGBHexWithoutOpacity();
......
......@@ -32,4 +32,6 @@ public interface Iconizable extends ProvidesID
}
String getFontColor(boolean isDarkTheme);
String getDefaultFontColor(boolean isDarkTheme);
}
......@@ -221,19 +221,20 @@ public class Template implements TransactionBase, Iconizable
final Icon icon = getIconReference();
if(icon == null)
{
return getAppropriateTextColor(isDarkTheme);
return getDefaultFontColor(isDarkTheme);
}
final String fontColor = icon.getFontColor();
if(fontColor == null)
{
return getAppropriateTextColor(isDarkTheme);
return getDefaultFontColor(isDarkTheme);
}
return fontColor;
}
private String getAppropriateTextColor(boolean isDarkTheme)
@Override
public String getDefaultFontColor(boolean isDarkTheme)
{
if(isDarkTheme)
{
......@@ -243,7 +244,6 @@ public class Template implements TransactionBase, Iconizable
return FONT_COLOR_LIGHT_THEME;
}
public List<Tag> getTags()
{
return tags;
......
......@@ -38,7 +38,7 @@ $(document).ready(function()
}
catch(e)
{
appropriateColor = '#2E79B9';
appropriateColor = fontColorPickerDefaultColor;
}
document.getElementById("item-icon-preview").style.color = appropriateColor;
......
......@@ -2,6 +2,7 @@
<#macro fontColorPicker item>
<input type="hidden" name="fontColor" id="fontColor" value="${item.getFontColor(settings.isUseDarkTheme())}">
<script>fontColorPickerDefaultColor = "${item.getDefaultFontColor(settings.isUseDarkTheme())}"</script>
<div class="row">
<div class="input-field col s12 m12 l8 offset-l2">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment