theme-Protectivecoloration
Publisher: sunyaodongThemes in package: 1
这是一个保护色主题
这是一个保护色主题
Full workbench mockup using this variant's colors and tokenColors.
Loading...
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| — | #000000 | — |
| comment | #1D613F | — |
| string | #2A00FF | — |
| constant.numeric | #AE00FF | — |
| constant.language | #FF00EA | — |
| constant.character, constant.other | #CC00FF | — |
| variable | #DB5000 | |
| keyword | #FF0080 | — |
| storage | #7f007f | |
| storage.type | #7f007f | italic |
| entity.name.class | #2A00FF | underline |
| entity.other.inherited-class | #00D364 | italic underline |
| entity.name.function | #0084FF | |
| variable.parameter | #001EFF | italic |
| entity.name.tag | #3F7F7F | |
| entity.other.attribute-name | #c7617f | |
| support.function | #FF0000 | |
| support.constant | — | |
| support.type, support.class | #CC66FF | italic |
| support.other.variable | — | |
| invalid | #F8F8F0 | |
| invalid.deprecated | #F8F8F0 | — |
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}!`;
}