diff --git a/www/index.html b/www/index.html
index 01fb35d..9865328 100644
--- a/www/index.html
+++ b/www/index.html
@@ -82,6 +82,15 @@
TR:
+
+
+
+
diff --git a/www/js/client.js b/www/js/client.js
index 27cba5d..8f793f5 100644
--- a/www/js/client.js
+++ b/www/js/client.js
@@ -53,11 +53,19 @@ function get_aggregate()
return OSU_FILES.where(x=> x)[0];
}
+function clearChildren(node)
+{
+ while(node.firstChild)
+ node.removeChild(node.firstChild);
+}
+
function clear_sidebar() {
for(const elem of document.getElementsByClassName("metadata")) {
elem.innerText="";
removeClass(elem, "meta-dupe");
}
+
+ clearChildren( document.getElementById("meta-colours"));
}
function populate_sidebar(osu) {
@@ -123,6 +131,27 @@ function populate_sidebar(osu) {
//Background
meta("background", "spec.Background");
+ //Colours
+ clearChildren(document.getElementById("meta-colours"));
+ if(osu.data.Colours) {
+ const colourList = document.getElementById("meta-colours");
+ const addColour = (rgb, combo) => {
+ const node = document.createElement("li");
+ node.setAttribute("class", "combo-colour");
+ node.setAttribute("id", "meta-colour-"+combo);
+ node.style.color = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")";
+ node.innerText = rgb.toString();
+ colourList.appendChild(node);
+ };
+ console.log(osu.data.Colours);
+ for(let key in osu.data.Colours) {
+ if(osu.data.Colours.hasOwnProperty(key)) {
+ const rgb = osu.data.Colours[key];
+ addColour(rgb, key);
+ }
+ }
+ }
+
SIDEBAR_VIEWING = osu;
}
}
diff --git a/www/js/osu.js b/www/js/osu.js
index 85c1928..dca6edb 100644
--- a/www/js/osu.js
+++ b/www/js/osu.js
@@ -27,6 +27,7 @@ OSU.LoadTokens = async function(tokens) {
"Metadata": new Stage(),
"Difficulty": new Stage(),
"Events": new Stage(),
+ "Colours": new Stage(),
"TimingPoints": new Stage(),
"HitObjects": new Stage(),
};
@@ -43,6 +44,7 @@ OSU.LoadTokens = async function(tokens) {
this.han(stages["Editor"]);
this.meta(stages["Metadata"]);
this.muzukashisa(stages["Difficulty"]);
+ this.iro(stages["Colours"]);
this.jiken(stages["Events"]);
this.keiji(stages["TimingPoints"]);
this.maru(stages["HitObjects"]);
@@ -173,6 +175,25 @@ OSU.muzukashisa = async function(tokens) {
};
+OSU.iro = async function(tokens) {
+ const group = await tokens.take();
+ if(group) {
+ var data = this.data[group];
+ var tok;
+
+ while(tok = await tokens.take()) {
+ var match = tok.match(/^(Combo\d+)\s:\s(\d+),(\d+),(\d+)$/);
+ if(match && match[0])
+ {
+ data[match[1]] = {r: parseInt(match[2]), g: parseInt(match[3]), b: parseInt(match[4]), toString: function() {
+ return "#"+ this.r.toString(16)+this.g.toString(16)+this.b.toString(16);
+ }};
+ }
+ else this.errors.push("iso: parsing line `"+tok+"' failed.");
+ }
+ }
+};
+
OSU.jiken = async function(tokens) {
const group = await tokens.take();
if(group) {