The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { |
| 2 | isMonochromeSourceControlIcon, |
| 3 | sourceControlClients, |
| 4 | } from "@t3tools/client-runtime/source-control-clients"; |
| 5 | import type { ImageSourcePropType } from "react-native"; |
| 6 | |
| 7 | import { SOURCE_CONTROL_LINK_ICON_SOURCES } from "./markdownLinkIcons.generated"; |
| 8 | |
| 9 | export interface MarkdownLinkIcon { |
| 10 | readonly source: ImageSourcePropType; |
| 11 | /** A mark drawn in the text colour takes the link's colour; a coloured mark keeps its own. */ |
| 12 | readonly tints: boolean; |
| 13 | } |
| 14 | |
| 15 | // `vp run sync:link-icons` renders each host's artwork into the bundled image this reads. |
| 16 | export function markdownLinkIcon(host: string): MarkdownLinkIcon | null { |
| 17 | const definition = sourceControlClients.findByPublicDomain(host); |
| 18 | const source = definition && SOURCE_CONTROL_LINK_ICON_SOURCES[definition.kind]; |
| 19 | return definition?.icon && source |
| 20 | ? { source, tints: isMonochromeSourceControlIcon(definition.icon) } |
| 21 | : null; |
| 22 | } |