diff --git a/docs/vercel/src/Index.svelte b/docs/vercel/src/Index.svelte index 6ed42c9b4..e7c8a3ee2 100644 --- a/docs/vercel/src/Index.svelte +++ b/docs/vercel/src/Index.svelte @@ -10,11 +10,12 @@ let showMenu: boolean; const languages: Language[] = Object.entries(data as Languages).map( - ([name, { type, ascii, colors }]) => ({ + ([name, { type, ascii, colors, icon }]) => ({ name, type, ascii, colors, + icon, }) ); @@ -30,6 +31,15 @@ return languages.filter(({ type }) => $filter.checkboxes.includes(type)); }); + function escapeToUnicode(unicodeEscape: string): string { + if (unicodeEscape) { + let codePoint = parseInt(unicodeEscape.slice(3, -1), 16); // extract the relevent portion of the escape + return String.fromCodePoint(codePoint); + } else { + return '\u{25CF}'; + } + } + onMount(async () => { const response = await fetch( 'https://api.github.com/repos/o2sh/onefetch/releases/latest' @@ -102,7 +112,8 @@ ansi={language.colors.ansi} hex={language.colors.hex} ascii={language.ascii} - chip={language.colors.chip} /> + chipColor={language.colors.chip} + chipIcon={escapeToUnicode(language.icon)} /> {/each} diff --git a/docs/vercel/src/components/AsciiPreview.svelte b/docs/vercel/src/components/AsciiPreview.svelte index 8f9c236ed..bc9618f58 100644 --- a/docs/vercel/src/components/AsciiPreview.svelte +++ b/docs/vercel/src/components/AsciiPreview.svelte @@ -1,13 +1,13 @@ - - - - diff --git a/docs/vercel/src/yaml.d.ts b/docs/vercel/src/yaml.d.ts index f9e7d7c57..cda6d3eb4 100644 --- a/docs/vercel/src/yaml.d.ts +++ b/docs/vercel/src/yaml.d.ts @@ -10,6 +10,7 @@ declare module '*/languages.yaml' { type: string; ascii: string; colors: LanguageColors; + icon: string; } export type Languages = Record;