hourly color coded feels like temperatures close #69
This commit is contained in:
parent
b3faf95e39
commit
a592668d0d
4 changed files with 24 additions and 6 deletions
|
|
@ -76,9 +76,9 @@ class Hourly extends WeatherDisplay {
|
||||||
const temperature = data.temperature.toString().padStart(3);
|
const temperature = data.temperature.toString().padStart(3);
|
||||||
const feelsLike = data.apparentTemperature.toString().padStart(3);
|
const feelsLike = data.apparentTemperature.toString().padStart(3);
|
||||||
fillValues.temp = temperature;
|
fillValues.temp = temperature;
|
||||||
// only plot apparent temperature if there is a difference
|
|
||||||
// if (temperature !== feelsLike) line.querySelector('.like').innerHTML = feelsLike;
|
// apparent temperature is color coded if different from actual temperature (after fill is applied)
|
||||||
if (temperature !== feelsLike) fillValues.like = feelsLike;
|
fillValues.like = feelsLike;
|
||||||
|
|
||||||
// wind
|
// wind
|
||||||
let wind = 'Calm';
|
let wind = 'Calm';
|
||||||
|
|
@ -91,7 +91,17 @@ class Hourly extends WeatherDisplay {
|
||||||
// image
|
// image
|
||||||
fillValues.icon = { type: 'img', src: data.icon };
|
fillValues.icon = { type: 'img', src: data.icon };
|
||||||
|
|
||||||
return this.fillTemplate('hourly-row', fillValues);
|
const filledRow = this.fillTemplate('hourly-row', fillValues);
|
||||||
|
|
||||||
|
// alter the color of the feels like column to reflect wind chill or heat index
|
||||||
|
if (feelsLike < temperature) {
|
||||||
|
filledRow.querySelector('.like').classList.add('wind-chill');
|
||||||
|
}
|
||||||
|
if (feelsLike > temperature) {
|
||||||
|
filledRow.querySelector('.like').classList.add('heat-index');
|
||||||
|
}
|
||||||
|
|
||||||
|
return filledRow;
|
||||||
});
|
});
|
||||||
|
|
||||||
list.append(...lines);
|
list.append(...lines);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -82,6 +82,14 @@
|
||||||
|
|
||||||
.like {
|
.like {
|
||||||
left: 425px;
|
left: 425px;
|
||||||
|
|
||||||
|
&.heat-index {
|
||||||
|
color: #e00;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.wind-chill {
|
||||||
|
color: c.$extended-low;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wind {
|
.wind {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue