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 ...@@ -163,6 +163,12 @@ public class Account implements ProvidesID, Iconizable
return fontColor; return fontColor;
} }
@Override
public String getDefaultFontColor(boolean isDarkTheme)
{
return ACCOUNT_FONT_COLOR;
}
@Override @Override
public String toString() public String toString()
{ {
......
...@@ -17,6 +17,9 @@ import java.util.Objects; ...@@ -17,6 +17,9 @@ import java.util.Objects;
@Entity @Entity
public class Category implements ProvidesID, Iconizable 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 @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Expose @Expose
...@@ -127,6 +130,17 @@ public class Category implements ProvidesID, Iconizable ...@@ -127,6 +130,17 @@ public class Category implements ProvidesID, Iconizable
return fontColor; return fontColor;
} }
@Override
public String getDefaultFontColor(boolean isDarkTheme)
{
if(isDarkTheme)
{
return FONT_COLOR_DARK_THEME;
}
return FONT_COLOR_LIGHT_THEME;
}
public String getAppropriateTextColor() public String getAppropriateTextColor()
{ {
return ColorUtilsNonJavaFX.getAppropriateTextColor(new Color(color)).toRGBHexWithoutOpacity(); return ColorUtilsNonJavaFX.getAppropriateTextColor(new Color(color)).toRGBHexWithoutOpacity();
......
...@@ -32,4 +32,6 @@ public interface Iconizable extends ProvidesID ...@@ -32,4 +32,6 @@ public interface Iconizable extends ProvidesID
} }
String getFontColor(boolean isDarkTheme); String getFontColor(boolean isDarkTheme);
String getDefaultFontColor(boolean isDarkTheme);
} }
...@@ -221,19 +221,20 @@ public class Template implements TransactionBase, Iconizable ...@@ -221,19 +221,20 @@ public class Template implements TransactionBase, Iconizable
final Icon icon = getIconReference(); final Icon icon = getIconReference();
if(icon == null) if(icon == null)
{ {
return getAppropriateTextColor(isDarkTheme); return getDefaultFontColor(isDarkTheme);
} }
final String fontColor = icon.getFontColor(); final String fontColor = icon.getFontColor();
if(fontColor == null) if(fontColor == null)
{ {
return getAppropriateTextColor(isDarkTheme); return getDefaultFontColor(isDarkTheme);
} }
return fontColor; return fontColor;
} }
private String getAppropriateTextColor(boolean isDarkTheme) @Override
public String getDefaultFontColor(boolean isDarkTheme)
{ {
if(isDarkTheme) if(isDarkTheme)
{ {
...@@ -243,7 +244,6 @@ public class Template implements TransactionBase, Iconizable ...@@ -243,7 +244,6 @@ public class Template implements TransactionBase, Iconizable
return FONT_COLOR_LIGHT_THEME; return FONT_COLOR_LIGHT_THEME;
} }
public List<Tag> getTags() public List<Tag> getTags()
{ {
return tags; return tags;
......
...@@ -38,7 +38,7 @@ $(document).ready(function() ...@@ -38,7 +38,7 @@ $(document).ready(function()
} }
catch(e) catch(e)
{ {
appropriateColor = '#2E79B9'; appropriateColor = fontColorPickerDefaultColor;
} }
document.getElementById("item-icon-preview").style.color = appropriateColor; document.getElementById("item-icon-preview").style.color = appropriateColor;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<#macro fontColorPicker item> <#macro fontColorPicker item>
<input type="hidden" name="fontColor" id="fontColor" value="${item.getFontColor(settings.isUseDarkTheme())}"> <input type="hidden" name="fontColor" id="fontColor" value="${item.getFontColor(settings.isUseDarkTheme())}">
<script>fontColorPickerDefaultColor = "${item.getDefaultFontColor(settings.isUseDarkTheme())}"</script>
<div class="row"> <div class="row">
<div class="input-field col s12 m12 l8 offset-l2"> <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