3.8
Improved 'Sow' and 'Harvest' calcs Better background on the event banners
This commit is contained in:
@@ -9,8 +9,16 @@
|
||||
// To add a new weather event: write a checkXxx(rows, location) function
|
||||
// below, export it, and add it to the checks[] array inside
|
||||
// getActiveEvents() (in events.js).
|
||||
//
|
||||
// Priority (safety) events also carry a `tint` — an [r,g,b] triple taken
|
||||
// from the same WEATHER TINT PALETTE the day tabs colour themselves from
|
||||
// (utils.js), so a heat banner reads the same orange as a hot day tab, a
|
||||
// rain banner the same blue, and so on. app.js turns it into the banner
|
||||
// background; events without a tint keep the default parchment banner.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
import { utciCategory, hexToRgb, rainTint, cloudTint } from '../utils.js';
|
||||
|
||||
export function checkStargazing(rows) {
|
||||
// Great stargazing: mostly clear night hours with low cloud.
|
||||
// Split night into contiguous runs (pre-dawn vs post-dusk) and evaluate
|
||||
@@ -138,6 +146,8 @@ export function checkHeatSpike(rows) {
|
||||
message: msgs[severity],
|
||||
color: severity === 'danger' ? '#3a0000' : severity === 'extreme-caution' ? '#4a1000' : '#5a2000',
|
||||
textColor: '#ffd0b0',
|
||||
// Same heat hue a day tab would use for this temperature.
|
||||
tint: hexToRgb(utciCategory(maxTemp).bg),
|
||||
type: 'weather',
|
||||
nightOnly: false,
|
||||
isoRange, // only show cell icon during the hot hours
|
||||
@@ -230,6 +240,8 @@ export function checkWind(rows) {
|
||||
message: `Gusts to ${mph} mph. ${desc}`,
|
||||
color,
|
||||
textColor,
|
||||
// Dry but windy — the day tabs' cloud-grey ramp, darkened by wind tier.
|
||||
tint: cloudTint(30 + tier * 12),
|
||||
type: 'weather',
|
||||
nightOnly: false,
|
||||
isoRange,
|
||||
@@ -259,6 +271,8 @@ export function checkWet(rows) {
|
||||
: `Moderate rain expected — up to ${maxPrecip.toFixed(1)} mm/h at peak. Keep a brolly handy.`,
|
||||
color: '#15212e',
|
||||
textColor: '#bcd6ee',
|
||||
// Rain wins over cloud in the day-tab priority order, so use the blue ramp.
|
||||
tint: rainTint(maxPrecip),
|
||||
type: 'weather',
|
||||
nightOnly: false,
|
||||
isoRange,
|
||||
@@ -289,6 +303,8 @@ export function checkStorm(rows) {
|
||||
message: `Gusts to ${mph} mph with ${rainLabel} (${maxPrecip.toFixed(1)} mm/h). ${windDesc}`,
|
||||
color,
|
||||
textColor,
|
||||
// Wind + rain: rain outranks cloud on the day tabs, so the blue ramp again.
|
||||
tint: rainTint(maxPrecip),
|
||||
type: 'weather',
|
||||
nightOnly: false,
|
||||
isoRange,
|
||||
@@ -314,6 +330,8 @@ export function checkFrost(rows) {
|
||||
: `Temperatures near freezing tonight (${minTemp.toFixed(1)}°C) — frost possible on exposed surfaces and vehicles.`,
|
||||
color: '#0a1a2a',
|
||||
textColor: '#c8e8ff',
|
||||
// Same cold blue a day tab would use for this temperature.
|
||||
tint: hexToRgb(utciCategory(minTemp).bg),
|
||||
type: 'weather',
|
||||
nightOnly: false,
|
||||
isoRange, // only show cell icon during the frosty hours
|
||||
|
||||
Reference in New Issue
Block a user