Skip to content

Commit 0e27bef

Browse files
committed
Add base16 export
1 parent 3d8af94 commit 0e27bef

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/routes/export/+page.svelte

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import { highlighter } from "$lib/shiki"
1010
import File from "$lib/icons/_file.svelte"
1111
import { copyToClipboard } from "$lib/utils"
12+
import Binary from "$lib/icons/binary.svelte"
1213
1314
let selected = $state<SupportedExport>("vscode")
1415
15-
type SupportedExport = "vscode" | "vim" | "filetypes"
16+
type SupportedExport = "vscode" | "vim" | "filetypes" | "base16"
1617
type Exportable = {
1718
name: string
1819
Icon: Component
@@ -33,6 +34,11 @@
3334
name: "Filetypes",
3435
value: "filetypes",
3536
Icon: File
37+
},
38+
{
39+
name: "Base16",
40+
value: "base16",
41+
Icon: Binary
3642
}
3743
]
3844
@@ -70,6 +76,30 @@ ${Object.entries($colors$)
7076
{ lang: "bash", theme: "theme" }
7177
)
7278
}
79+
80+
async function createBase16Snippet() {
81+
const hl = await highlighter
82+
83+
return hl.codeToHtml(
84+
`base00: "${formatHex($colors$.base)}" # base
85+
base01: "${formatHex($colors$.mantle)}" # mantle
86+
base02: "${formatHex($colors$.surface0)}" # surface0
87+
base03: "${formatHex($colors$.surface1)}" # surface1
88+
base04: "${formatHex($colors$.surface2)}" # surface2
89+
base05: "${formatHex($colors$.text)}" # text
90+
base06: "${formatHex($colors$.rosewater)}" # rosewater
91+
base07: "${formatHex($colors$.lavender)}" # lavender
92+
base08: "${formatHex($colors$.red)}" # red
93+
base09: "${formatHex($colors$.peach)}" # peach
94+
base0A: "${formatHex($colors$.yellow)}" # yellow
95+
base0B: "${formatHex($colors$.green)}" # green
96+
base0C: "${formatHex($colors$.teal)}" # teal
97+
base0D: "${formatHex($colors$.blue)}" # blue
98+
base0E: "${formatHex($colors$.mauve)}" # mauve
99+
base0F: "${formatHex($colors$.flamingo)}" # flamingo`,
100+
{ lang: "bash", theme: "theme" }
101+
)
102+
}
73103
</script>
74104

75105
<svelte:head>
@@ -134,6 +164,10 @@ ${Object.entries($colors$)
134164
{#await createAppSnippet() then snippet}
135165
{@render Code(snippet)}
136166
{/await}
167+
{:else if selected === "base16"}
168+
{#await createBase16Snippet() then snippet}
169+
{@render Code(snippet)}
170+
{/await}
137171
{/if}
138172
</div>
139173
</div>

0 commit comments

Comments
 (0)