diff --git a/css/styles.css b/css/styles.css index 1dcca7e..fa575e3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -401,6 +401,46 @@ input[type=number] { white-space: nowrap; } +#turnipTable td.range4 { + background-color: hsl(0, 80%, 85%); +} + +#turnipTable td.range3{ + background-color: hsl(30, 80%, 85%); +} + +#turnipTable td.range2 { + background-color: hsl(60, 80%, 85%); +} + +#turnipTable td.range1 { + background-color: hsl(90, 80%, 85%); +} + +#turnipTable td.range0 { + background-color: hsl(140, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range0 { + background-color: hsl(0, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range1{ + background-color: hsl(30, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range2 { + background-color: hsl(60, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range3 { + background-color: hsl(90, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range4 { + background-color: hsl(140, 80%, 85%); +} + .chart-wrapper { margin-top: 8px; display: flex; diff --git a/js/scripts.js b/js/scripts.js index 7533090..1bd48b8 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -249,6 +249,17 @@ const getSellPrices = function () { }) } +const getPriceClass = function(buy_price, max) { + const priceBrackets = [200, 30, 0, -30, -99]; + let diff = max - buy_price; + for(var i=0; i= priceBrackets[i]) { + return "range" + i; + } + } + return ""; +} + const calculateOutput = function (data, first_buy, previous_pattern) { if (isEmpty(data)) { $("#output").html(""); @@ -257,6 +268,7 @@ const calculateOutput = function (data, first_buy, previous_pattern) { let output_possibilities = ""; let predictor = new Predictor(data, first_buy, previous_pattern); let analyzed_possibilities = predictor.analyze_possibilities(); + let buy_price = parseInt(buy_input.val()); previous_pattern_number = "" for (let poss of analyzed_possibilities) { var out_line = "" + poss.pattern_description + "" @@ -270,13 +282,17 @@ const calculateOutput = function (data, first_buy, previous_pattern) { } out_line += `${percentage_display(poss.probability)}`; for (let day of poss.prices.slice(1)) { + let price_class = getPriceClass(buy_price, day.max); if (day.min !== day.max) { - out_line += `${day.min} ${i18next.t("output.to")} ${day.max}`; + out_line += `${day.min} ${i18next.t("output.to")} ${day.max}`; } else { - out_line += `${day.min}`; + out_line += `${day.min}`; } } - out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; + + var min_class = getPriceClass(buy_price, poss.weekGuaranteedMinimum); + var max_class = getPriceClass(buy_price, poss.weekMax); + out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; output_possibilities += out_line }