3.0.2.4
Move At A Glance panel left. Tweak day tabs highlight and add danger level pulsing. Arrange at a glance order to make more sense and better priority. New brighter favicon.
This commit is contained in:
@@ -69,21 +69,31 @@ function weatherGradient(r, g, b) {
|
||||
// colour, drawn as a radial gradient whose strong colour sits at the outer
|
||||
// edge and softens toward a lighter centre — so the hue reads as radiating
|
||||
// inward from the outside of the tab.
|
||||
function weatherGradientNeutral(r, g, b) {
|
||||
const blend = (c) => Math.round(c + (255 - c) * 0.58);
|
||||
const [mr, mg, mb] = [blend(r), blend(g), blend(b)];
|
||||
// edgeBlend pastelises the outer edge (higher = lighter). centerBlend, when
|
||||
// supplied, blends the centre straight from the raw colour for a lighter core
|
||||
// (used by the Danger tier to keep a dark edge but a light centre); otherwise
|
||||
// the centre is just a lightened version of the edge (original behaviour).
|
||||
function weatherGradientNeutral(r, g, b, edgeBlend = 0.50, centerBlend = null) {
|
||||
const blend = (c, amt) => Math.round(c + (255 - c) * amt);
|
||||
const lighten = (c) => Math.min(255, Math.round(c + (255 - c) * 0.38));
|
||||
const center = `rgb(${lighten(mr)},${lighten(mg)},${lighten(mb)})`;
|
||||
const edge = `rgb(${mr},${mg},${mb})`;
|
||||
const [er, eg, eb] = [blend(r, edgeBlend), blend(g, edgeBlend), blend(b, edgeBlend)];
|
||||
const [cr, cg, cb] = centerBlend != null
|
||||
? [blend(r, centerBlend), blend(g, centerBlend), blend(b, centerBlend)]
|
||||
: [lighten(er), lighten(eg), lighten(eb)];
|
||||
const center = `rgb(${cr},${cg},${cb})`;
|
||||
const edge = `rgb(${er},${eg},${eb})`;
|
||||
return `radial-gradient(circle at 50% 50%, ${center} 0%, ${center} 28%, ${edge} 100%)`;
|
||||
}
|
||||
|
||||
function weatherGradientActive(r, g, b) {
|
||||
const blend = (c) => Math.round(c + (255 - c) * 0.42);
|
||||
const [mr, mg, mb] = [blend(r), blend(g), blend(b)];
|
||||
function weatherGradientActive(r, g, b, edgeBlend = 0.42, centerBlend = null) {
|
||||
const blend = (c, amt) => Math.round(c + (255 - c) * amt);
|
||||
const lighten = (c) => Math.min(255, Math.round(c + (255 - c) * 0.38));
|
||||
const center = `rgb(${lighten(mr)},${lighten(mg)},${lighten(mb)})`;
|
||||
const edge = `rgb(${mr},${mg},${mb})`;
|
||||
const [er, eg, eb] = [blend(r, edgeBlend), blend(g, edgeBlend), blend(b, edgeBlend)];
|
||||
const [cr, cg, cb] = centerBlend != null
|
||||
? [blend(r, centerBlend), blend(g, centerBlend), blend(b, centerBlend)]
|
||||
: [lighten(er), lighten(eg), lighten(eb)];
|
||||
const center = `rgb(${cr},${cg},${cb})`;
|
||||
const edge = `rgb(${er},${eg},${eb})`;
|
||||
return `radial-gradient(circle at 50% 50%, ${center} 0%, ${center} 28%, ${edge} 100%)`;
|
||||
}
|
||||
|
||||
@@ -322,6 +332,7 @@ export function DayTabs({
|
||||
|
||||
// Base RGB for each weather condition — pastelised by weatherGradient()
|
||||
const [wR, wG, wB] = (daySnow >= 0.1) ? [100, 160, 230]
|
||||
: (dayHi > 44) ? [136, 0, 0]
|
||||
: (dayHi > 38) ? [210, 60, 30]
|
||||
: showPrecip ? [ 50, 120, 200]
|
||||
: (dayHi > 32) ? [220, 110, 30]
|
||||
@@ -331,15 +342,23 @@ export function DayTabs({
|
||||
: modalCloudCat === 'scattered' ? [160, 150, 130]
|
||||
: modalCloudCat === 'wispy' ? [200, 180, 130]
|
||||
: [220, 190, 50];
|
||||
// Danger days keep a dark, saturated edge with a lighter centre.
|
||||
const isDanger = dayHi !== null && dayHi > 44;
|
||||
const wBg = weatherGradient(wR, wG, wB);
|
||||
const wBgNeutral = weatherGradientNeutral(wR, wG, wB);
|
||||
const wBgActive = weatherGradientActive(wR, wG, wB);
|
||||
const wBgNeutral = isDanger
|
||||
? weatherGradientNeutral(wR, wG, wB, 0.15, 0.72)
|
||||
: weatherGradientNeutral(wR, wG, wB);
|
||||
const wBgActive = isDanger
|
||||
? weatherGradientActive(wR, wG, wB, 0.12, 0.72)
|
||||
: weatherGradientActive(wR, wG, wB);
|
||||
const wText = '#2a1d10';
|
||||
// Active-tab outline: the day's weather colour, 20% darker.
|
||||
const wOutline = `rgb(${Math.round(wR * 0.8)},${Math.round(wG * 0.8)},${Math.round(wB * 0.8)})`;
|
||||
|
||||
return html`
|
||||
<button
|
||||
key=${d.key}
|
||||
class=${`utci-day-tab ${isActive ? 'active' : ''}${locked ? ' locked' : ''}`}
|
||||
class=${`utci-day-tab ${isActive ? 'active' : ''}${locked ? ' locked' : ''}${isDanger ? ' danger' : ''}`}
|
||||
onClick=${() => {
|
||||
if (locked) {
|
||||
setProPromptSource('day');
|
||||
@@ -362,6 +381,9 @@ export function DayTabs({
|
||||
opacity: locked ? 0.5 : 1,
|
||||
cursor: locked ? 'not-allowed' : 'pointer',
|
||||
position: 'relative',
|
||||
filter: isActive ? 'saturate(1.1) brightness(1.04)' : 'none',
|
||||
outline: isActive ? `2px solid ${wOutline}` : 'none',
|
||||
outlineOffset: isActive ? '-2px' : '0',
|
||||
}}
|
||||
>
|
||||
${locked && html`
|
||||
|
||||
Reference in New Issue
Block a user