Svelte Theme 5
Publisher: Zubair Ibn ZamirThemes in package: 1
Svelte Theme, inspired by Svelte Docs
Svelte Theme, inspired by Svelte Docs
Full workbench mockup using this variant's colors and tokenColors.
Loading...
Workbench UI color keys from the theme JSON colors map.
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| comment, punctuation.definition.comment | #8c8c8c | — |
| keyword, storage.type, storage.modifier | #57b5f4 | — |
| entity.name.tag, support.type.property-name.json, source meta.var.expr meta.function-call, support.function, meta.definition.function, meta.function-call, source.svelte, meta.selector.css, constant.numeric.css, meta.embedded.block.svelte constant.numeric.decimal.js, source.svelte meta.embedded.expression.svelte source.ts constant.numeric.decimal, punctuation.definition.variable.svelte, meta.type.annotation entity.name.type | #ebaf94 | — |
| string, punctuation.definition.string, meta.tag.void.svelte meta.embedded.expression.svelte variable.other.readwrite.ts | #ccb88f | — |
| source, text, punctuation.accessor, string.template.js, keyword.operator, meta.attribute-selector, entity.name.type, source meta.embedded.block.svelte meta.function, variable.other.object, source.svelte meta.tag.void.svelte meta.directive.bind.svelte meta.embedded.expression.svelte source.ts variable.other.readwrite.ts, entity.other.attribute-name.svelte, punctuation.separator.key-value.svelte, punctuation.section.embedded, string.quoted.svelte variable.other.readwrite.ts, meta.attribute.alt.svelte meta.embedded.expression.svelte variable.other.readwrite, punctuation.definition.block.begin.svelte, punctuation.definition.block.end.svelte, punctuation.definition.tag.begin.svelte, punctuation.definition.tag.end.svelte, punctuation.definition.string.template.begin.js, punctuation.definition.string.template.end.js, punctuation.definition.keyword.svelte | #c4c1bb | — |
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}