@streamscloud/kit 0.68.0 → 0.68.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,4 +5,8 @@ export declare const fileTypeColors: Record<string, string>;
|
|
|
5
5
|
* entry of `fileTypeColors` counts regardless of length (`.sketch`).
|
|
6
6
|
*/
|
|
7
7
|
export declare const fileTypeFromName: (name: string) => string;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Stamp color of a file type (an extension, e.g. from `fileTypeFromName`). `fallback` is returned for a type missing from
|
|
10
|
+
* `fileTypeColors` — pass your own color, or `''` to detect an unknown type.
|
|
11
|
+
*/
|
|
12
|
+
export declare const fileTypeColor: (type: string, fallback?: string) => string;
|
|
@@ -6,24 +6,49 @@ export const fileTypeColors = {
|
|
|
6
6
|
pdf: '#e15554',
|
|
7
7
|
doc: '#144ab0',
|
|
8
8
|
docx: '#144ab0',
|
|
9
|
+
odt: '#144ab0',
|
|
10
|
+
rtf: '#144ab0',
|
|
9
11
|
xls: '#10b981',
|
|
10
12
|
xlsx: '#10b981',
|
|
13
|
+
ods: '#10b981',
|
|
11
14
|
csv: '#10b981',
|
|
12
15
|
ppt: '#e0772e',
|
|
13
16
|
pptx: '#e0772e',
|
|
17
|
+
odp: '#e0772e',
|
|
14
18
|
zip: '#f5a623',
|
|
15
19
|
rar: '#f5a623',
|
|
20
|
+
'7z': '#f5a623',
|
|
21
|
+
tar: '#f5a623',
|
|
22
|
+
gz: '#f5a623',
|
|
23
|
+
tgz: '#f5a623',
|
|
24
|
+
bz2: '#f5a623',
|
|
16
25
|
fig: '#1abc9c',
|
|
17
26
|
sketch: '#fdb022',
|
|
18
27
|
png: '#8b5cf6',
|
|
19
28
|
jpg: '#8b5cf6',
|
|
20
29
|
jpeg: '#8b5cf6',
|
|
21
30
|
gif: '#8b5cf6',
|
|
31
|
+
webp: '#8b5cf6',
|
|
32
|
+
avif: '#8b5cf6',
|
|
33
|
+
heic: '#8b5cf6',
|
|
34
|
+
heif: '#8b5cf6',
|
|
35
|
+
bmp: '#8b5cf6',
|
|
36
|
+
tif: '#8b5cf6',
|
|
37
|
+
tiff: '#8b5cf6',
|
|
22
38
|
svg: '#7c3aed',
|
|
23
39
|
mp4: '#ec4899',
|
|
24
40
|
mov: '#ec4899',
|
|
41
|
+
webm: '#ec4899',
|
|
42
|
+
mkv: '#ec4899',
|
|
43
|
+
avi: '#ec4899',
|
|
44
|
+
m4v: '#ec4899',
|
|
25
45
|
mp3: '#f97066',
|
|
26
46
|
wav: '#f97066',
|
|
47
|
+
ogg: '#f97066',
|
|
48
|
+
m4a: '#f97066',
|
|
49
|
+
flac: '#f97066',
|
|
50
|
+
aac: '#f97066',
|
|
51
|
+
opus: '#f97066',
|
|
27
52
|
txt: '#6b7280',
|
|
28
53
|
md: '#6b7280',
|
|
29
54
|
json: '#7c3aed',
|
|
@@ -45,4 +70,8 @@ export const fileTypeFromName = (name) => {
|
|
|
45
70
|
const tail = name.slice(dot + 1).toLowerCase();
|
|
46
71
|
return fileTypeColors[tail] !== undefined || EXTENSION_SHAPE.test(tail) ? tail : '';
|
|
47
72
|
};
|
|
48
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Stamp color of a file type (an extension, e.g. from `fileTypeFromName`). `fallback` is returned for a type missing from
|
|
75
|
+
* `fileTypeColors` — pass your own color, or `''` to detect an unknown type.
|
|
76
|
+
*/
|
|
77
|
+
export const fileTypeColor = (type, fallback = '#6b7280') => fileTypeColors[type.toLowerCase()] ?? fallback;
|