initial commit

This commit is contained in:
terraputix
2026-01-07 22:24:02 +01:00
commit 2d31df88f0
315 changed files with 14484 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
export default [
'#800080',
'#800083',
'#800087',
'#7f008a',
'#7f008d',
'#7e0090',
'#7d0094',
'#7c0097',
'#7a009a',
'#79009d',
'#7700a1',
'#7600a4',
'#7400a7',
'#7200aa',
'#6f00ae',
'#6d00b1',
'#6a00b4',
'#6700b7',
'#6400bb',
'#6100be',
'#5e00c1',
'#5b00c4',
'#5700c8',
'#5300cb',
'#4f00ce',
'#4b00d1',
'#4700d5',
'#4200d8',
'#3e00db',
'#3900de',
'#3400e2',
'#2f00e5',
'#2a00e8',
'#2400eb',
'#1f00ef',
'#1900f2',
'#1300f5',
'#0d00f8',
'#0600fc',
'#0000ff',
'#0000ff',
'#0021f7',
'#003fee',
'#005ce6',
'#0076dd',
'#008ed5',
'#00a3cc',
'#00b7c4',
'#00bbaf',
'#00b38f',
'#00aa72',
'#00a256',
'#00993d',
'#009127',
'#008812',
'#008000',
'#008000',
'#118c00',
'#259700',
'#3ca300',
'#56ae00',
'#72ba00',
'#92c500',
'#b4d100',
'#d9dc00',
'#e8cf00',
'#f3bb00',
'#ffa500',
'#ffa500',
'#ff9800',
'#ff8c00',
'#ff7f00',
'#ff7200',
'#ff6600',
'#ff5900',
'#ff4c00',
'#ff3f00',
'#ff3300',
'#ff2600',
'#ff1900',
'#ff0d00',
'#ff0000',
'#ff0000',
'#f8000f',
'#f0001c',
'#e90029',
'#e10035',
'#da0040',
'#d2004a',
'#cb0053',
'#c3005c',
'#bc0063',
'#b4006a',
'#ad0070',
'#a50075',
'#9e0079',
'#96007c',
'#8f007e',
'#870080',
'#800080'
];
+51
View File
@@ -0,0 +1,51 @@
import colorScaleHex from './color-scale-hex';
function componentFromStr(numStr: string, percent: number) {
const num = Math.max(0, parseInt(numStr, 10));
return percent ? Math.floor((255 * Math.min(100, num)) / 100) : Math.min(255, num);
}
export function rgbToHex(rgb: string) {
const rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
let result,
r,
g,
b,
hex = '';
if ((result = rgbRegex.exec(rgb))) {
r = componentFromStr(result[1], result[2]);
g = componentFromStr(result[3], result[4]);
b = componentFromStr(result[5], result[6]);
hex = (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
if (!rgb) {
return '355522';
}
return hex;
}
export const getColor = (temp: number, unit = 'celsius'): string => {
let index = 0;
temp = Number(temp);
if (unit === 'celsius') {
if (temp <= -40) {
index = 0;
} else if (temp >= 60) {
index = colorScaleHex.length - 1;
} else {
index = temp + 40;
}
} else {
const tempInCelsius = Math.round(((temp - 32) * 5) / 9);
if (tempInCelsius <= -40) {
index = 0;
} else if (tempInCelsius >= 60) {
index = colorScaleHex.length - 1;
} else {
index = tempInCelsius + 40;
}
}
return colorScaleHex[index];
};
File diff suppressed because one or more lines are too long
+81
View File
@@ -0,0 +1,81 @@
export default {
0: 'clear',
1: 'clear',
2: 'cloudy',
3: 'cloudy',
4: 'fog',
5: 'fog',
10: 'fog',
11: 'fog',
12: 'lightning',
18: 'strong-wind',
20: 'fog',
21: 'rain-mix',
22: 'rain-mix',
23: 'rain',
24: 'snow',
25: 'hail',
26: 'thunderstorm',
27: 'dust',
28: 'dust',
29: 'dust',
30: 'fog',
31: 'fog',
32: 'fog',
33: 'fog',
34: 'fog',
35: 'fog',
40: 'rain-mix',
41: 'sprinkle',
42: 'rain',
43: 'sprinkle',
44: 'rain',
45: 'hail',
46: 'hail',
47: 'snow',
48: 'snow',
50: 'sprinkle',
51: 'sprinkle',
52: 'rain',
53: 'rain',
54: 'snowflake-cold',
55: 'snowflake-cold',
56: 'snowflake-cold',
57: 'sprinkle',
58: 'rain',
60: 'sprinkle',
61: 'sprinkle',
62: 'rain',
63: 'rain',
64: 'hail',
65: 'hail',
66: 'hail',
67: 'rain-mix',
68: 'rain-mix',
70: 'snow',
71: 'snow',
72: 'snow',
73: 'snow',
74: 'snowflake-cold',
75: 'snowflake-cold',
76: 'snowflake-cold',
77: 'snow',
78: 'snowflake-cold',
80: 'rain',
81: 'sprinkle',
82: 'rain',
83: 'rain',
84: 'storm-showers',
85: 'rain-mix',
86: 'rain-mix',
87: 'rain-mix',
89: 'hail',
90: 'lightning',
91: 'storm-showers',
92: 'thunderstorm',
93: 'thunderstorm',
94: 'lightning',
95: 'thunderstorm',
96: 'thunderstorm',
99: 'tornado'
};