18 lines
868 B
TypeScript
18 lines
868 B
TypeScript
import type { ElementName, FiveElementReport } from './fiveElements'
|
|
|
|
export const elementIcons: Record<ElementName, { kind: string; label: string; color: string }> = {
|
|
木: { kind: 'wood', label: '木', color: '#409d61' },
|
|
火: { kind: 'fire', label: '火', color: '#e66a49' },
|
|
土: { kind: 'earth', label: '土', color: '#ac754d' },
|
|
金: { kind: 'metal', label: '金', color: '#c69324' },
|
|
水: { kind: 'water', label: '水', color: '#369fc6' }
|
|
}
|
|
|
|
// The entry represents the day master's element, not the largest percentage or favorable element.
|
|
export function getDayMasterIcon(report: Pick<FiveElementReport, 'masterElement'> | null | undefined) {
|
|
const element = report?.masterElement
|
|
return element && Object.prototype.hasOwnProperty.call(elementIcons, element)
|
|
? elementIcons[element]
|
|
: { kind: 'unknown', label: '?', color: '#9a91b1' }
|
|
}
|