import { RANK } from "./utils.ts"; import { Theme } from "./theme.ts"; const leafIcon = (laurel: string): string => { return ` Created by potrace 1.15, written by Peter Selinger 2001-2017 `; }; export const getNextRankBar = ( title: string, percentage: number, color: string, ): string => { const maxWidth = 80; return ` `; }; const getSmallTrophyIcon = ( icon: string, color: string, count: number, ): string => { const leftXPosition = 7; const rightXPosition = 68; const getIcon = (x: number) => { return ` ${icon} `; }; if (count == 1) { // Double Rank return getIcon(rightXPosition); } else if (count == 2) { // Triple Rank return `${getIcon(leftXPosition)}${getIcon(rightXPosition)}`; } // Single Rank return ""; }; export const getTrophyIcon = (theme: Theme, rank = RANK.UNKNOWN) => { let color = theme.DEFAULT_RANK_BASE; let rankColor = theme.DEFAULT_RANK_TEXT; let backgroundIcon = ""; let gradationColor = ` `; const { ICON_CIRCLE } = theme; if (rank === RANK.SECRET) { rankColor = theme.SECRET_RANK_TEXT; gradationColor = ` `; } else if (rank.slice(0, 1) === RANK.S) { color = theme.S_RANK_BASE; rankColor = theme.S_RANK_TEXT; backgroundIcon = leafIcon(theme.LAUREL); gradationColor = ` `; } else if (rank.slice(0, 1) === RANK.A) { color = theme.A_RANK_BASE; rankColor = theme.A_RANK_TEXT; backgroundIcon = leafIcon(theme.LAUREL); gradationColor = ` `; } else if (rank === RANK.B) { color = theme.B_RANK_BASE; rankColor = theme.B_RANK_TEXT; gradationColor = ` `; } const icon = ` ${ rank.slice(0, 1) } `; const optionRankIcon = getSmallTrophyIcon(icon, color, rank.length - 1); return ` ${backgroundIcon} ${optionRankIcon} ${gradationColor} ${icon} `; };