diff --git a/android/assets/themes/bandw.theme b/android/assets/themes/bandw.theme index e121e7c..fa1c91b 100644 --- a/android/assets/themes/bandw.theme +++ b/android/assets/themes/bandw.theme @@ -3,6 +3,7 @@ "price": 20, "colors": { "background": "0a0a0aff", + "foreground": "f0f0f0ff", "buttons": [ "4d4d4dff", "4d4d4dff", @@ -18,7 +19,8 @@ "current_score": "b3b3b3ff", "high_score": "f9f9f9ff", "bonus": "f9f9f9ff", - "band": "4d4d4dff" + "band": "4d4d4dff", + "text": "f0f0f0ff" }, "cell_texture": "basic.png" } diff --git a/android/assets/themes/dark.theme b/android/assets/themes/dark.theme index 654e204..df7b253 100644 --- a/android/assets/themes/dark.theme +++ b/android/assets/themes/dark.theme @@ -3,6 +3,7 @@ "price": 0, "colors": { "background": "333333ff", + "foreground": "ddddddff", "buttons": [ "03c13dff", "007da4ff", @@ -18,7 +19,8 @@ "current_score": "c83737ff", "high_score": "d400aaff", "bonus": "e3e3e3ff", - "band": "2b5ccfff" + "band": "2b5ccfff", + "text": "ffffffff" }, "cell_texture": "basic.png" } diff --git a/android/assets/themes/default.theme b/android/assets/themes/default.theme index 595d0e6..ee6b2c6 100644 --- a/android/assets/themes/default.theme +++ b/android/assets/themes/default.theme @@ -3,6 +3,7 @@ "price": 0, "colors": { "background": "ffffffff", + "foreground": "ffffffff", "buttons": [ "00ff33ff", "ffd700ff", @@ -18,7 +19,8 @@ "current_score": "ffcc00ff", "high_score": "65d681ff", "bonus": "4d4d4dff", - "band": "87ceebff" + "band": "87ceebff", + "text": "111111ff" }, "cell_texture": "basic.png" } diff --git a/core/src/io/github/lonamiwebs/klooni/Theme.java b/core/src/io/github/lonamiwebs/klooni/Theme.java index 12ff1d6..489210f 100644 --- a/core/src/io/github/lonamiwebs/klooni/Theme.java +++ b/core/src/io/github/lonamiwebs/klooni/Theme.java @@ -24,12 +24,14 @@ public class Theme { private int price; public Color background; + public Color foreground; public Color emptyCell; public Color currentScore; public Color highScore; public Color bonus; public Color bandColor; + public Color textColor; private Color[] cells; private Color[] buttons; @@ -84,6 +86,20 @@ public class Theme { return new Theme().update(handle); } + // Used to determine the best foreground color (black or white) given a background color + // Formula took from http://alienryderflex.com/hsp.html + // Not used yet, but may be useful + private final static double BRIGHTNESS_CUTOFF = 0.5; + + public static boolean shouldUseWhite(Color color) { + double brightness = Math.sqrt( + color.r * color.r * .299 + + color.g * color.g * .587 + + color.b * color.b * .114); + + return brightness < BRIGHTNESS_CUTOFF; + } + //endregion //region Theme updating @@ -105,8 +121,9 @@ public class Theme { price = json.getInt("price"); JsonValue colors = json.get("colors"); - background = new Color( // Java won't allow unsigned integers, we need to use Long - (int)Long.parseLong(colors.getString("background"), 16)); + // Java won't allow unsigned integers, we need to use Long + background = new Color((int)Long.parseLong(colors.getString("background"), 16)); + foreground = new Color((int)Long.parseLong(colors.getString("foreground"), 16)); JsonValue buttonColors = colors.get("buttons"); buttons = new Color[buttonColors.size]; @@ -125,6 +142,7 @@ public class Theme { highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16)); bonus = new Color((int)Long.parseLong(colors.getString("bonus"), 16)); bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16)); + textColor = new Color((int)Long.parseLong(colors.getString("text"), 16)); emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16)); diff --git a/core/src/io/github/lonamiwebs/klooni/actors/Band.java b/core/src/io/github/lonamiwebs/klooni/actors/Band.java index db3e3e8..e789ac9 100644 --- a/core/src/io/github/lonamiwebs/klooni/actors/Band.java +++ b/core/src/io/github/lonamiwebs/klooni/actors/Band.java @@ -65,9 +65,11 @@ public class Band extends Actor { scoreLabel.setBounds(x + scoreBounds.x, y + scoreBounds.y, scoreBounds.width, scoreBounds.height); scoreLabel.setText(Integer.toString(scorer.getCurrentScore())); + scoreLabel.setColor(Klooni.theme.textColor); scoreLabel.draw(batch, parentAlpha); infoLabel.setBounds(x + infoBounds.x, y + infoBounds.y, infoBounds.width, infoBounds.height); + infoLabel.setColor(Klooni.theme.textColor); infoLabel.draw(batch, parentAlpha); } diff --git a/core/src/io/github/lonamiwebs/klooni/actors/MoneyBuyBand.java b/core/src/io/github/lonamiwebs/klooni/actors/MoneyBuyBand.java index d4f5088..59ecfd4 100644 --- a/core/src/io/github/lonamiwebs/klooni/actors/MoneyBuyBand.java +++ b/core/src/io/github/lonamiwebs/klooni/actors/MoneyBuyBand.java @@ -182,6 +182,7 @@ public class MoneyBuyBand extends Table { } } setColor(Klooni.theme.bandColor); + infoLabel.setColor(Klooni.theme.textColor); super.draw(batch, parentAlpha); } diff --git a/core/src/io/github/lonamiwebs/klooni/actors/SoftButton.java b/core/src/io/github/lonamiwebs/klooni/actors/SoftButton.java index 1ce1f94..d79c7ff 100644 --- a/core/src/io/github/lonamiwebs/klooni/actors/SoftButton.java +++ b/core/src/io/github/lonamiwebs/klooni/actors/SoftButton.java @@ -1,5 +1,6 @@ package io.github.lonamiwebs.klooni.actors; +import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.utils.Drawable; @@ -44,6 +45,7 @@ public class SoftButton extends ImageButton { Klooni.theme.updateStyle(style, styleIndex); style.imageUp = image; + getImage().setColor(Klooni.theme.foreground); super.draw(batch, parentAlpha); } diff --git a/core/src/io/github/lonamiwebs/klooni/actors/ThemeCard.java b/core/src/io/github/lonamiwebs/klooni/actors/ThemeCard.java index 425202c..611e3c8 100644 --- a/core/src/io/github/lonamiwebs/klooni/actors/ThemeCard.java +++ b/core/src/io/github/lonamiwebs/klooni/actors/ThemeCard.java @@ -30,12 +30,6 @@ public class ThemeCard extends Actor { //endregion - //region Static members - - private final static double BRIGHTNESS_CUTOFF = 0.5; - - //endregion - //region Constructor public ThemeCard(final Klooni game, final GameLayout layout, final Theme theme) { @@ -48,9 +42,8 @@ public class ThemeCard extends Actor { priceLabel = new Label("", labelStyle); nameLabel = new Label(theme.getDisplay(), labelStyle); - Color labelColor = shouldUseWhite(theme.background) ? Color.WHITE : Color.BLACK; - priceLabel.setColor(labelColor); - nameLabel.setColor(labelColor); + priceLabel.setColor(theme.textColor); + nameLabel.setColor(theme.textColor); priceBounds = new Rectangle(); nameBounds = new Rectangle(); @@ -112,19 +105,4 @@ public class ThemeCard extends Actor { } //endregion - - //region Private methods - - // Used to determine the best foreground color (black or white) given a background color - // Formula took from http://alienryderflex.com/hsp.html - private static boolean shouldUseWhite(Color color) { - double brightness = Math.sqrt( - color.r * color.r * .299 + - color.g * color.g * .587 + - color.b * color.b * .114); - - return brightness < BRIGHTNESS_CUTOFF; - } - - //endregion } diff --git a/themes/generate_theme.py b/themes/generate_theme.py index 31fab81..6f3925d 100755 --- a/themes/generate_theme.py +++ b/themes/generate_theme.py @@ -16,6 +16,7 @@ template = '''{{ "price": {price}, "colors": {{ "background": "{background}", + "foreground": "{foreground}", "buttons": [ "{button_0}", "{button_1}", @@ -31,7 +32,8 @@ template = '''{{ "current_score": "{current_score}", "high_score": "{high_score}", "bonus": "{bonus}", - "band": "{band}" + "band": "{band}", + "text": "{text}" }}, "cell_texture": "{cell_tex}" }} diff --git a/themes/template.svg b/themes/template.svg index 30f717a..30891d4 100644 --- a/themes/template.svg +++ b/themes/template.svg @@ -1,42 +1,17 @@ - - + id="svg2" + viewBox="0 0 800.00001 700.00001" + height="746.66669" + width="853.33331"> - @@ -50,228 +25,234 @@ + transform="translate(0,-352.36216)" + id="layer1"> + transform="translate(0,-199.99998)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + d="M 26.857031,798.76837 H 378.28562 V 907.33982 H 26.857031 Z" + style="opacity:1;fill:#00f230;fill-opacity:1;stroke:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + transform="translate(0,-199.99998)"> - - - + style="fill:#2182ef;fill-opacity:1" + id="export_button_2" + transform="translate(0,-199.99998)"> + id="rect4153" + style="opacity:1;fill:#2182ef;fill-opacity:1;stroke:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> - - - - - - + style="fill:#ce4444;fill-opacity:1" + id="export_button_3" + transform="translate(0,-199.99998)"> + style="opacity:1;fill:#ce4444;fill-opacity:1;stroke:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4155" + width="105.7143" + height="108.57145" + x="266.85712" + y="921.62555" /> + style="fill:#ffcc00;fill-opacity:1" + id="export_current_score" + transform="translate(0,-199.99998)"> + style="opacity:1;fill:#ffcc00;fill-opacity:1;stroke:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 106.16769,680.7189 a 20.572971,33.748715 52.281084 0 0 -0.3613,0.23047 h -3.5703 a 31.071428,74.892753 0 0 0 0.207,2.32227 20.572971,33.748715 52.281084 0 0 -17.67971,31.1875 20.572971,33.748715 52.281084 0 0 27.33211,9.97851 31.071428,74.892753 0 0 0 16.5234,18.62501 19.482912,22.977165 0 0 0 -14.6016,18.60157 h 38.4278 a 19.482912,22.977165 0 0 0 -15.1055,-18.75 31.071428,74.892753 0 0 0 16.3164,-18.47853 33.748715,20.572971 37.718916 0 0 27.3379,-9.97656 33.748715,20.572971 37.718916 0 0 -17.6738,-31.1836 31.071428,74.892753 0 0 0 0.2011,-2.32617 h -3.5703 a 33.748715,20.572971 37.718916 0 0 -0.3613,-0.23047 l -0.033,0.23047 h -53.3555 l -0.033,-0.23047 z m -3.2187,8.00977 a 31.071428,74.892753 0 0 0 7.5312,32.01562 16.78108,29.001088 59.891063 0 1 -22.259706,-8.39257 16.78108,29.001088 59.891063 0 1 14.728506,-23.62305 z m 59.8652,0.004 a 29.001088,16.78108 30.108937 0 1 14.7227,23.61915 29.001088,16.78108 30.108937 0 1 -22.2637,8.39062 31.071428,74.892753 0 0 0 7.541,-32.00977 z m -29.9355,4.67774 4.1054,8.31836 9.1797,1.33398 -6.6426,6.47461 1.5684,9.14453 -8.2109,-4.3164 -8.211,4.3164 1.5684,-9.14453 -6.6445,-6.47461 9.1816,-1.33398 z" + id="path4181" /> + + + + + + + + + + + + + + +