pref: colorful card

This commit is contained in:
Ou
2024-10-12 12:49:20 +08:00
parent 5d87ce3ea4
commit 698253e4ae
10 changed files with 109 additions and 42 deletions
+26
View File
@@ -0,0 +1,26 @@
export const colors = [
"blue", // #0000FF
"indigo", // #4B0082
"violet", // #EE82EE
"purple", // #800080
"fuchsia", // #FF00FF
"pink", // #FFC0CB
"rose", // #FF007F
"amber", // #FFBF00
"yellow", // #FFFF00
"lime", // #00FF00
"green", // #008000
"emerald", // #50C878
"teal", // #008080
"cyan", // #00FFFF
"sky", // #87CEEB
"slate", // #708090
"gray", // #808080
"zinc", // #A0A0A0
"neutral", // #828282
"stone", // #D2B48C
"red", // #FF0000
"orange", // #FFA500
] as const
export type Color = typeof colors[number]
+15 -3
View File
@@ -14,11 +14,13 @@ const Time = {
export const originSources = {
"v2ex": {
name: "V2EX",
color: "slate",
home: "https://v2ex.com/",
},
"coolapk": {
name: "酷安",
type: "hottest",
color: "green",
home: "https://coolapk.com",
},
"wallstreetcn": {
@@ -29,10 +31,12 @@ export const originSources = {
},
"sputniknewscn": {
name: "俄罗斯卫星通讯社",
color: "yellow",
home: "https://sputniknews.cn",
},
"cankaoxiaoxi": {
name: "参考消息",
color: "red",
interval: Time.Common,
home: "https://china.cankaoxiaoxi.com",
},
@@ -48,6 +52,7 @@ export const originSources = {
"douyin": {
name: "抖音",
type: "hottest",
color: "gray",
home: "https://www.douyin.com",
},
"hupu": {
@@ -63,6 +68,7 @@ export const originSources = {
name: "微博",
title: "实时热搜",
type: "hottest",
color: "red",
interval: Time.Realtime,
home: "https://weibo.com",
},
@@ -73,6 +79,7 @@ export const originSources = {
"zaobao": {
name: "联合早报",
interval: Time.Common,
color: "red",
home: "https://www.zaobao.com",
},
"thepaper": {
@@ -83,10 +90,12 @@ export const originSources = {
"toutiao": {
name: "今日头条",
type: "hottest",
color: "red",
home: "https://www.toutiao.com",
},
"ithome": {
name: "IT之家",
color: "red",
home: "https://www.ithome.com",
},
} as const satisfies Record<string, OriginSource>
@@ -103,14 +112,16 @@ function genSources() {
redirect: `${id}-${subId}`,
name: source.name,
type: source.type,
interval: source.interval,
color: source.color ?? "blue",
interval: source.interval ?? Time.Default,
...subSource,
}] as [any, Source])
}
_.push([`${id}-${subId}`, {
name: source.name,
type: source.type,
interval: source.interval,
color: source.color ?? "blue",
interval: source.interval ?? Time.Default,
...subSource,
}] as [any, Source])
})
@@ -118,7 +129,8 @@ function genSources() {
_.push([id, {
name: source.name,
type: source.type,
interval: source.interval,
color: source.color ?? "blue",
interval: source.interval ?? Time.Default,
title: source.title,
}])
}
+4 -1
View File
@@ -1,3 +1,4 @@
import type { Color } from "./colors"
import type { sectionIds } from "./data"
import type { originSources } from "./sources"
@@ -26,6 +27,7 @@ export interface OriginSource {
*/
type?: "hottest" | "latest"
home: string
color?: Color
sub?: Record<string, {
title: string
/**
@@ -40,7 +42,8 @@ export interface Source {
name: string
title?: string
type?: "hottest" | "latest"
interval?: number
color: Color
interval: number
redirect?: SourceID
}