diff --git a/src/main/java/ru/windcorp/progressia/client/ClientProxy.java b/src/main/java/ru/windcorp/progressia/client/ClientProxy.java
index ac9d61f..0948082 100644
--- a/src/main/java/ru/windcorp/progressia/client/ClientProxy.java
+++ b/src/main/java/ru/windcorp/progressia/client/ClientProxy.java
@@ -25,6 +25,7 @@ import ru.windcorp.progressia.client.graphics.backend.RenderTaskQueue;
import ru.windcorp.progressia.client.graphics.flat.FlatRenderProgram;
import ru.windcorp.progressia.client.graphics.font.GNUUnifontLoader;
import ru.windcorp.progressia.client.graphics.font.Typefaces;
+import ru.windcorp.progressia.client.graphics.gui.ColorScheme;
import ru.windcorp.progressia.client.graphics.texture.Atlases;
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
import ru.windcorp.progressia.client.localization.Localizer;
@@ -50,7 +51,8 @@ public class ClientProxy implements Proxy {
} catch (InterruptedException e) {
throw CrashReports.report(e, "ClientProxy failed");
}
-
+
+ ColorScheme.load(ResourceManager.getResource("assets/default.colorScheme"));
Localizer.getInstance().setLanguage("en-US");
TestContent.registerContent();
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/Colors.java b/src/main/java/ru/windcorp/progressia/client/graphics/Colors.java
index b37a6a8..78aa79b 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/Colors.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/Colors.java
@@ -34,13 +34,7 @@ public class Colors {
DEBUG_BLUE = toVector(0xFF0000FF),
DEBUG_CYAN = toVector(0xFF00FFFF),
DEBUG_MAGENTA = toVector(0xFFFF00FF),
- DEBUG_YELLOW = toVector(0xFFFFFF00),
-
- LIGHT_GRAY = toVector(0xFFCBCBD0),
- BLUE = toVector(0xFF37A2E6),
- HOVER_BLUE = toVector(0xFFC3E4F7),
- DISABLED_GRAY = toVector(0xFFE5E5E5),
- DISABLED_BLUE = toVector(0xFFB2D8ED);
+ DEBUG_YELLOW = toVector(0xFFFFFF00);
public static Vec4 toVector(int argb) {
return toVector(argb, new Vec4());
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Button.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Button.java
index 5d42241..2e8da79 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Button.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Button.java
@@ -18,10 +18,8 @@
package ru.windcorp.progressia.client.graphics.gui;
-import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
import ru.windcorp.progressia.client.graphics.font.Font;
-import ru.windcorp.progressia.client.graphics.Colors;
public class Button extends BasicButton {
@@ -39,45 +37,26 @@ public class Button extends BasicButton {
@Override
protected void assembleSelf(RenderTarget target) {
- // Border
-
- Vec4 borderColor;
- if (isPressed() || isHovered() || isFocused()) {
- borderColor = Colors.BLUE;
+ String state;
+ if (!isEnabled()) {
+ state = "Disabled";
+ } else if (isPressed()) {
+ state = "Pressed";
+ } else if (isHovered()) {
+ state = "Hovered";
+ } else if (isFocused()) {
+ state = "Focused";
} else {
- borderColor = Colors.LIGHT_GRAY;
+ state = "Inactive";
}
- target.fill(getX(), getY(), getWidth(), getHeight(), borderColor);
+
+ // Border
+ target.fill(getX(), getY(), getWidth(), getHeight(), ColorScheme.get("Core:ButtonBorder" + state));
// Inside area
-
- if (isPressed()) {
- // Do nothing
- } else {
- Vec4 backgroundColor;
- if (isHovered() && isEnabled()) {
- backgroundColor = Colors.HOVER_BLUE;
- } else {
- backgroundColor = Colors.WHITE;
- }
- target.fill(getX() + 2, getY() + 2, getWidth() - 4, getHeight() - 4, backgroundColor);
- }
+ target.fill(getX() + 2, getY() + 2, getWidth() - 4, getHeight() - 4, ColorScheme.get("Core:ButtonFill" + state));
// Change label font color
-
- if (isPressed()) {
- getLabel().setFont(getLabel().getFont().withColor(Colors.WHITE));
- } else {
- getLabel().setFont(getLabel().getFont().withColor(Colors.BLACK));
- }
- }
-
- @Override
- protected void postAssembleSelf(RenderTarget target) {
- // Apply disable tint
-
- if (!isEnabled()) {
- target.fill(getX(), getY(), getWidth(), getHeight(), Colors.toVector(0x88FFFFFF));
- }
+ getLabel().setFont(getLabel().getFont().withColor(ColorScheme.get("Core:ButtonText" + state)));
}
}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
index 990ed43..8ae5a1c 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Checkbox.java
@@ -18,8 +18,6 @@
package ru.windcorp.progressia.client.graphics.gui;
import glm.vec._2.i.Vec2i;
-import glm.vec._4.Vec4;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.font.Typefaces;
@@ -42,35 +40,29 @@ public class Checkbox extends BasicButton {
int size = getPreferredSize().x;
int x = getX();
int y = getY() + (getHeight() - size) / 2;
-
- // Border
-
- Vec4 borderColor;
- if (Checkbox.this.isPressed() || Checkbox.this.isHovered() || Checkbox.this.isFocused()) {
- borderColor = Colors.BLUE;
+
+ String state;
+ if (!Checkbox.this.isEnabled()) {
+ state = "Disabled";
+ } else if (Checkbox.this.isPressed()) {
+ state = "Pressed";
+ } else if (Checkbox.this.isHovered()) {
+ state = "Hovered";
+ } else if (Checkbox.this.isFocused()) {
+ state = "Focused";
} else {
- borderColor = Colors.LIGHT_GRAY;
+ state = "Inactive";
}
- target.fill(x, y, size, size, borderColor);
+
+ // Border
+ target.fill(x, y, size, size, ColorScheme.get("Core:CheckboxBorder" + state));
// Inside area
-
- if (Checkbox.this.isPressed()) {
- // Do nothing
- } else {
- Vec4 backgroundColor;
- if (Checkbox.this.isHovered() && Checkbox.this.isEnabled()) {
- backgroundColor = Colors.HOVER_BLUE;
- } else {
- backgroundColor = Colors.WHITE;
- }
- target.fill(x + 2, y + 2, size - 4, size - 4, backgroundColor);
- }
+ target.fill(x + 2, y + 2, size - 4, size - 4, ColorScheme.get("Core:CheckboxFill" + state));
// "Tick"
-
if (Checkbox.this.isChecked()) {
- target.fill(x + 4, y + 4, size - 8, size - 8, Colors.BLUE);
+ target.fill(x + 4, y + 4, size - 8, size - 8, ColorScheme.get("Core:CheckboxCheck" + state));
}
}
@@ -128,22 +120,21 @@ public class Checkbox extends BasicButton {
@Override
protected void assembleSelf(RenderTarget target) {
- // Change label font color
-
- if (isPressed()) {
- getLabel().setFont(getLabel().getFont().withColor(Colors.BLUE));
+ String state;
+ if (!Checkbox.this.isEnabled()) {
+ state = "Disabled";
+ } else if (Checkbox.this.isPressed()) {
+ state = "Pressed";
+ } else if (Checkbox.this.isHovered()) {
+ state = "Hovered";
+ } else if (Checkbox.this.isFocused()) {
+ state = "Focused";
} else {
- getLabel().setFont(getLabel().getFont().withColor(Colors.BLACK));
+ state = "Inactive";
}
+
+ // Change label font color
+ getLabel().setFont(getLabel().getFont().withColor(ColorScheme.get("Core:CheckboxText" + state)));
}
-
- @Override
- protected void postAssembleSelf(RenderTarget target) {
- // Apply disable tint
-
- if (!isEnabled()) {
- target.fill(getX(), getY(), getWidth(), getHeight(), Colors.toVector(0x88FFFFFF));
- }
- }
-
+
}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/ColorScheme.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/ColorScheme.java
new file mode 100644
index 0000000..d7b71f4
--- /dev/null
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/ColorScheme.java
@@ -0,0 +1,145 @@
+/*
+ * Progressia
+ * Copyright (C) 2020-2022 Wind Corporation and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package ru.windcorp.progressia.client.graphics.gui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap;
+
+import glm.vec._4.Vec4;
+import ru.windcorp.jputil.SyntaxException;
+import ru.windcorp.jputil.chars.StringUtil;
+import ru.windcorp.progressia.common.resource.Resource;
+import ru.windcorp.progressia.common.util.crash.CrashReports;
+import ru.windcorp.progressia.common.util.namespaces.IllegalIdException;
+import ru.windcorp.progressia.common.util.namespaces.NamespacedUtil;
+
+public class ColorScheme {
+
+ private static Map defaultScheme;
+
+ public static Vec4 get(String key) {
+ Vec4 color = defaultScheme.get(key);
+ if (color == null) {
+ throw CrashReports.report(null, "ColorScheme does not contain color %s", key);
+ }
+ return color;
+ }
+
+ public static void load(Resource resource) {
+ Map tmpMap = new HashMap<>();
+
+ try {
+ for (String fullLine : StringUtil.split(resource.readAsString(), '\n')) {
+ String line = fullLine.trim();
+ if (line.isEmpty() || line.startsWith("#")) {
+ continue;
+ }
+
+ String[] parts = StringUtil.split(line, '=', 2);
+ if (parts[1] == null) {
+ throw new SyntaxException("Could not parse \"" + line + "\": '=' not found");
+ }
+
+ String key = parts[0].trim();
+ checkKeyName(key);
+ if (tmpMap.containsKey(key)) {
+ throw new SyntaxException("Duplicate key " + key);
+ }
+
+ String value = parts[1].trim();
+ Vec4 color;
+
+ if (value.startsWith("#")) {
+ color = parseValueAsHex(value);
+ } else if (value.startsWith("$")) {
+ color = parseValueAsReference(value, tmpMap);
+ } else {
+ throw new SyntaxException("Unknown value format \"" + value + "\"");
+ }
+
+ tmpMap.put(key, color);
+ }
+ } catch (SyntaxException e) {
+ throw CrashReports.report(e, "Could not load ColorScheme from %s", resource);
+ }
+
+ defaultScheme = ImmutableMap.copyOf(tmpMap);
+ }
+
+ private static void checkKeyName(String key) throws SyntaxException {
+ try {
+ NamespacedUtil.checkId(key);
+ } catch (IllegalIdException e) {
+ throw new SyntaxException("Illegal key name \"" + key + "\"", e);
+ }
+ }
+
+ private static int parseHex(String from, int start, int length) {
+ return Integer.parseInt(from.substring(start, start + length), 0x10);
+ }
+
+ private static Vec4 parseValueAsHex(String value) throws SyntaxException {
+ int a = 0xFF;
+ int r, g, b;
+
+ switch (value.length() - 1) {
+ case 3:
+ // #RGB
+ r = parseHex(value, 1, 1) * 0x11;
+ g = parseHex(value, 2, 1) * 0x11;
+ b = parseHex(value, 3, 1) * 0x11;
+ break;
+ case 4:
+ // #ARGB
+ a = parseHex(value, 1, 1) * 0x11;
+ r = parseHex(value, 2, 1) * 0x11;
+ g = parseHex(value, 3, 1) * 0x11;
+ b = parseHex(value, 4, 1) * 0x11;
+ break;
+ case 6:
+ // #RRGGBB
+ r = parseHex(value, 1, 2);
+ g = parseHex(value, 3, 2);
+ b = parseHex(value, 5, 2);
+ break;
+ case 8:
+ // #AARRGGBB
+ a = parseHex(value, 1, 2);
+ r = parseHex(value, 3, 2);
+ g = parseHex(value, 5, 2);
+ b = parseHex(value, 7, 2);
+ break;
+ default:
+ throw new SyntaxException("Could not parse hex color \"" + value + "\": expecting #RGB, #ARGB, #RRGGBB or #AARRGGBB");
+ }
+
+ return new Vec4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
+ }
+
+ private static Vec4 parseValueAsReference(String value, Map map) throws SyntaxException {
+ String otherKey = value.substring(1);
+ checkKeyName(otherKey);
+ if (!map.containsKey(otherKey)) {
+ throw new SyntaxException("Key $" + otherKey + " not found");
+ }
+ return map.get(otherKey);
+ }
+
+}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
index 90357ef..3c8df1f 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Panel.java
@@ -20,7 +20,6 @@ package ru.windcorp.progressia.client.graphics.gui;
import java.util.Objects;
import glm.vec._4.Vec4;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
public class Panel extends Group {
@@ -36,7 +35,7 @@ public class Panel extends Group {
}
public Panel(String name, Layout layout) {
- this(name, layout, Colors.WHITE, Colors.LIGHT_GRAY);
+ this(name, layout, ColorScheme.get("Core:Background"), ColorScheme.get("Core:Border"));
}
/**
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
index 8ea76f3..d7eac87 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/RadioButton.java
@@ -21,7 +21,6 @@ import org.lwjgl.glfw.GLFW;
import glm.vec._2.i.Vec2i;
import glm.vec._4.Vec4;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.font.Typefaces;
@@ -51,35 +50,29 @@ public class RadioButton extends BasicButton {
int size = getPreferredSize().x;
int x = getX();
int y = getY() + (getHeight() - size) / 2;
+
+ String state;
+ if (!RadioButton.this.isEnabled()) {
+ state = "Disabled";
+ } else if (RadioButton.this.isPressed()) {
+ state = "Pressed";
+ } else if (RadioButton.this.isHovered()) {
+ state = "Hovered";
+ } else if (RadioButton.this.isFocused()) {
+ state = "Focused";
+ } else {
+ state = "Inactive";
+ }
// Border
-
- Vec4 borderColor;
- if (RadioButton.this.isPressed() || RadioButton.this.isHovered() || RadioButton.this.isFocused()) {
- borderColor = Colors.BLUE;
- } else {
- borderColor = Colors.LIGHT_GRAY;
- }
- cross(target, x, y, size, borderColor);
+ cross(target, x, y, size, ColorScheme.get("Core:RadioButtonBorder" + state));
// Inside area
-
- if (RadioButton.this.isPressed()) {
- // Do nothing
- } else {
- Vec4 backgroundColor;
- if (RadioButton.this.isHovered() && RadioButton.this.isEnabled()) {
- backgroundColor = Colors.HOVER_BLUE;
- } else {
- backgroundColor = Colors.WHITE;
- }
- cross(target, x + 2, y + 2, size - 4, backgroundColor);
- }
+ cross(target, x + 2, y + 2, size - 4, ColorScheme.get("Core:RadioButtonFill" + state));
// "Tick"
-
if (RadioButton.this.isChecked()) {
- cross(target, x + 4, y + 4, size - 8, Colors.BLUE);
+ cross(target, x + 4, y + 4, size - 8, ColorScheme.get("Core:RadioButtonCheck" + state));
}
}
@@ -146,8 +139,8 @@ public class RadioButton extends BasicButton {
group.selectNext();
removeAction(group.listener);
group.buttons.remove(this);
- group.getSelected(); // Clear reference if this was the only button
- // in the group
+ // Clear reference if this was the only button in the group
+ group.getSelected();
}
this.group = group;
@@ -183,22 +176,21 @@ public class RadioButton extends BasicButton {
@Override
protected void assembleSelf(RenderTarget target) {
- // Change label font color
-
- if (isPressed()) {
- getLabel().setFont(getLabel().getFont().withColor(Colors.BLUE));
+ String state;
+ if (!RadioButton.this.isEnabled()) {
+ state = "Disabled";
+ } else if (RadioButton.this.isPressed()) {
+ state = "Pressed";
+ } else if (RadioButton.this.isHovered()) {
+ state = "Hovered";
+ } else if (RadioButton.this.isFocused()) {
+ state = "Focused";
} else {
- getLabel().setFont(getLabel().getFont().withColor(Colors.BLACK));
+ state = "Inactive";
}
- }
- @Override
- protected void postAssembleSelf(RenderTarget target) {
- // Apply disable tint
-
- if (!isEnabled()) {
- target.fill(getX(), getY(), getWidth(), getHeight(), Colors.toVector(0x88FFFFFF));
- }
+ // Change label font color
+ getLabel().setFont(getLabel().getFont().withColor(ColorScheme.get("Core:RadioButtonText" + state)));
}
}
diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/menu/MenuLayer.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/menu/MenuLayer.java
index 2c42cf0..1d2f1c9 100644
--- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/menu/MenuLayer.java
+++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/menu/MenuLayer.java
@@ -20,9 +20,9 @@ package ru.windcorp.progressia.client.graphics.gui.menu;
import org.lwjgl.glfw.GLFW;
import glm.vec._2.i.Vec2i;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.GUI;
import ru.windcorp.progressia.client.graphics.font.Font;
+import ru.windcorp.progressia.client.graphics.gui.ColorScheme;
import ru.windcorp.progressia.client.graphics.gui.Component;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
import ru.windcorp.progressia.client.graphics.gui.Label;
@@ -50,7 +50,7 @@ public class MenuLayer extends GUILayer {
setCursorPolicy(CursorPolicy.REQUIRE);
- this.background = new Panel(name + ".Background", new LayoutAlign(10), Colors.toVector(0x66000000), null);
+ this.background = new Panel(name + ".Background", new LayoutAlign(10), ColorScheme.get("Core:MenuLayerTint"), null);
this.content = content;
background.addChild(content);
@@ -76,12 +76,12 @@ public class MenuLayer extends GUILayer {
protected void addTitle() {
String translationKey = "Layer" + getName() + ".Title";
MutableString titleText = new MutableStringLocalized(translationKey);
- Font titleFont = new Font().deriveBold().withColor(Colors.BLACK).withAlign(0.5f);
+ Font titleFont = new Font().deriveBold().withColor(ColorScheme.get("Core:Text")).withAlign(0.5f);
Label label = new Label(getName() + ".Title", titleFont, titleText);
getContent().addChild(label);
- Panel panel = new Panel(getName() + ".Title.Underscore", null, Colors.BLUE, null);
+ Panel panel = new Panel(getName() + ".Title.Underscore", null, ColorScheme.get("Core:Accent"), null);
panel.setLayout(new LayoutFill() {
@Override
public Vec2i calculatePreferredSize(Component c) {
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerAbout.java b/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
index 0011985..509af9b 100644
--- a/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerAbout.java
@@ -22,6 +22,7 @@ import ru.windcorp.progressia.Progressia;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.font.Typeface;
+import ru.windcorp.progressia.client.graphics.gui.ColorScheme;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
import ru.windcorp.progressia.client.graphics.gui.Label;
import ru.windcorp.progressia.client.graphics.gui.Group;
@@ -37,7 +38,7 @@ public class LayerAbout extends GUILayer {
Group group = new Group("ControlDisplays", new LayoutVertical(5));
Font font = new Font().withColor(Colors.WHITE).deriveOutlined().withAlign(Typeface.ALIGN_RIGHT);
- Font aboutFont = font.withColor(0xFF37A3E6).deriveBold();
+ Font aboutFont = font.withColor(ColorScheme.get("Core:Accent")).deriveBold();
group.addChild(
new Label(
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java b/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
index 4e6cd77..5abcf32 100644
--- a/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerButtonTest.java
@@ -20,11 +20,11 @@ package ru.windcorp.progressia.test;
import java.util.Collection;
import ru.windcorp.progressia.client.ClientState;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.GUI;
import ru.windcorp.progressia.client.graphics.font.Font;
import ru.windcorp.progressia.client.graphics.gui.Button;
import ru.windcorp.progressia.client.graphics.gui.Checkbox;
+import ru.windcorp.progressia.client.graphics.gui.ColorScheme;
import ru.windcorp.progressia.client.graphics.gui.Label;
import ru.windcorp.progressia.client.graphics.gui.RadioButton;
import ru.windcorp.progressia.client.graphics.gui.RadioButtonGroup;
@@ -65,7 +65,7 @@ public class LayerButtonTest extends MenuLayer {
getContent().getChild(getContent().getChildren().size() - 1).setEnabled(false);
- getContent().addChild(new Label("Hint", new Font().withColor(Colors.LIGHT_GRAY), "This is a MenuLayer"));
+ getContent().addChild(new Label("Hint", new Font().withColor(ColorScheme.get("Core:Border")), "This is a MenuLayer"));
getContent().addChild(new Button("Continue", "Continue").addAction(b -> {
getCloseAction().run();
diff --git a/src/main/java/ru/windcorp/progressia/test/LayerTestText.java b/src/main/java/ru/windcorp/progressia/test/LayerTestText.java
index a4d202b..3cc9e09 100644
--- a/src/main/java/ru/windcorp/progressia/test/LayerTestText.java
+++ b/src/main/java/ru/windcorp/progressia/test/LayerTestText.java
@@ -1,11 +1,13 @@
package ru.windcorp.progressia.test;
import java.util.function.Consumer;
-import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.font.Font;
+import ru.windcorp.progressia.client.graphics.gui.ColorScheme;
import ru.windcorp.progressia.client.graphics.gui.GUILayer;
import ru.windcorp.progressia.client.graphics.gui.Label;
+import ru.windcorp.progressia.client.graphics.gui.Panel;
import ru.windcorp.progressia.client.graphics.gui.layout.LayoutAlign;
+import ru.windcorp.progressia.client.graphics.gui.layout.LayoutFill;
import ru.windcorp.progressia.client.localization.MutableString;
public class LayerTestText extends GUILayer {
@@ -13,11 +15,13 @@ public class LayerTestText extends GUILayer {
private final Consumer remover;
public LayerTestText(String name, MutableString value, Consumer remover) {
- super(name, new LayoutAlign(15));
+ super(name, new LayoutFill());
this.remover = remover;
- Font titleFont = new Font().deriveBold().withColor(Colors.BLACK).withAlign(0.5f);
- getRoot().addChild(new Label(name + ".Text", titleFont, value));
+ Panel panel = new Panel(name + ".Background", new LayoutAlign(15), ColorScheme.get("Core:Background"), null);
+ Font titleFont = new Font().deriveBold().withColor(ColorScheme.get("Core:Text")).withAlign(0.5f);
+ panel.addChild(new Label(name + ".Text", titleFont, value));
+ getRoot().addChild(panel);
}
@Override
diff --git a/src/main/resources/assets/default.colorScheme b/src/main/resources/assets/default.colorScheme
new file mode 100644
index 0000000..180beff
--- /dev/null
+++ b/src/main/resources/assets/default.colorScheme
@@ -0,0 +1,80 @@
+# Default color scheme for Progressia
+#
+# Line format:
+# KEY = VALUE
+# KEY must be a legal ID
+# VALUE may be one of the following:
+# #RGB
+# #ARGB
+# #RRGGBB
+# #AARRGGBB
+# $OTHER_KEY
+
+Core:Background = #EFF0F1
+Core:Border = #CBCBD0
+Core:DisabledBackground = $Core:Background
+Core:DisabledBorder = #DEDFE1
+Core:Accent = #37A3E6
+Core:AccentLighter = #C3E4F7
+
+Core:Text = #31363B
+
+Core:ButtonBorderDisabled = $Core:DisabledBorder
+Core:ButtonBorderPressed = $Core:Accent
+Core:ButtonBorderHovered = $Core:Accent
+Core:ButtonBorderFocused = $Core:Accent
+Core:ButtonBorderInactive = $Core:Border
+Core:ButtonFillDisabled = $Core:DisabledBackground
+Core:ButtonFillPressed = $Core:Accent
+Core:ButtonFillHovered = $Core:AccentLighter
+Core:ButtonFillFocused = $Core:Background
+Core:ButtonFillInactive = $Core:Background
+Core:ButtonTextDisabled = $Core:DisabledBorder
+Core:ButtonTextPressed = $Core:Background
+Core:ButtonTextHovered = $Core:Text
+Core:ButtonTextFocused = $Core:Text
+Core:ButtonTextInactive = $Core:Text
+
+Core:CheckboxBorderDisabled = $Core:DisabledBorder
+Core:CheckboxBorderPressed = $Core:Accent
+Core:CheckboxBorderHovered = $Core:Accent
+Core:CheckboxBorderFocused = $Core:Accent
+Core:CheckboxBorderInactive = $Core:Border
+Core:CheckboxFillDisabled = $Core:DisabledBackground
+Core:CheckboxFillPressed = $Core:Accent
+Core:CheckboxFillHovered = $Core:AccentLighter
+Core:CheckboxFillFocused = $Core:Background
+Core:CheckboxFillInactive = $Core:Background
+Core:CheckboxTextDisabled = $Core:DisabledBorder
+Core:CheckboxTextPressed = $Core:Accent
+Core:CheckboxTextHovered = $Core:Text
+Core:CheckboxTextFocused = $Core:Text
+Core:CheckboxTextInactive = $Core:Text
+Core:CheckboxCheckDisabled = $Core:DisabledBorder
+Core:CheckboxCheckPressed = $Core:Accent
+Core:CheckboxCheckHovered = $Core:Accent
+Core:CheckboxCheckFocused = $Core:Accent
+Core:CheckboxCheckInactive = $Core:Accent
+
+Core:RadioButtonBorderDisabled = $Core:DisabledBorder
+Core:RadioButtonBorderPressed = $Core:Accent
+Core:RadioButtonBorderHovered = $Core:Accent
+Core:RadioButtonBorderFocused = $Core:Accent
+Core:RadioButtonBorderInactive = $Core:Border
+Core:RadioButtonFillDisabled = $Core:DisabledBackground
+Core:RadioButtonFillPressed = $Core:Accent
+Core:RadioButtonFillHovered = $Core:AccentLighter
+Core:RadioButtonFillFocused = $Core:Background
+Core:RadioButtonFillInactive = $Core:Background
+Core:RadioButtonTextDisabled = $Core:DisabledBorder
+Core:RadioButtonTextPressed = $Core:Accent
+Core:RadioButtonTextHovered = $Core:Text
+Core:RadioButtonTextFocused = $Core:Text
+Core:RadioButtonTextInactive = $Core:Text
+Core:RadioButtonCheckDisabled = $Core:DisabledBorder
+Core:RadioButtonCheckPressed = $Core:Accent
+Core:RadioButtonCheckHovered = $Core:Accent
+Core:RadioButtonCheckFocused = $Core:Accent
+Core:RadioButtonCheckInactive = $Core:Accent
+
+Core:MenuLayerTint = #6000