Velvet Orchid
Luxurious theme with deep burgundy velvet and golden orchid accents
Luxurious theme with deep burgundy velvet and golden orchid accents
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 |
|---|---|---|
| emphasis | — | italic |
| strong | — | bold |
| header | #A2546E | — |
| comment, punctuation.definition.comment | #6D6259 | italic |
| comment keyword.codetag.notation, comment.block.documentation keyword, storage.type.class.jsdoc | #9B7BB0 | — |
| comment.block.documentation variable.other, comment.block.documentation entity.name.type | #6B9B9B | italic |
| string | #C9A86C | — |
| punctuation.definition.string.begin, punctuation.definition.string.end | #A68B52 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end | #A2546E | — |
| meta.template.expression | #E8E0D8 | — |
| constant, variable.other.constant | #D4B483 | — |
| constant.numeric | #9B7BB0 | — |
| constant.language.boolean | #C4728A | — |
| constant.language.null, constant.language.undefined | #C4728A | italic |
| keyword | #A2546E | — |
| storage.type, storage.modifier | #A2546E | italic |
| keyword.control | #A2546E | — |
| keyword.control.import, keyword.control.export, keyword.control.from | #A2546E | italic |
| entity.name.function, meta.function-call | #8B9EB0 | — |
| variable.parameter | #D4B483 | italic |
| storage.type.function.arrow | #A2546E | — |
| entity.name.type.class, entity.name.class | #6B9B9B | bold |
| entity.name.type.interface | #6B9B9B | italic |
| entity.name.type, support.type | #6B9B9B | italic |
| entity.name.type.parameter | #D4B483 | — |
| variable | #E8E0D8 | — |
| variable.language | #C4728A | italic |
| variable.other.property, meta.object-literal.key | #B0A59A | — |
| entity.name.tag | #A2546E | — |
| entity.other.attribute-name | #D4B483 | italic |
| string.quoted.double.html, string.quoted.single.html | #C9A86C | — |
| meta.selector, entity.other.attribute-name.class.css, entity.other.attribute-name.id.css | #6B9B9B | — |
| support.type.property-name.css | #8B9EB0 | — |
| support.constant.property-value.css, meta.property-value.css | #D4B483 | — |
| keyword.other.unit.css | #9B7BB0 | — |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #A2546E | — |
| keyword.operator | #A2546E | — |
| keyword.operator.comparison, keyword.operator.relational | #6B9B9B | — |
| keyword.operator.logical | #A2546E | — |
| punctuation | #B0A59A | — |
| punctuation.definition.block, meta.brace | #B0A59A | — |
| string.regexp | #C4728A | — |
| punctuation.definition.group.regexp, keyword.operator.quantifier.regexp | #9B7BB0 | — |
| meta.decorator, punctuation.decorator | #9B7BB0 | — |
| markup.heading, heading.1.markdown, heading.2.markdown, heading.3.markdown | #A2546E | bold |
| markup.bold | #D4B483 | bold |
| markup.italic | #9B7BB0 | italic |
| markup.underline.link, string.other.link | #8B9EB0 | — |
| markup.inline.raw, markup.fenced_code.block | #C9A86C | — |
| markup.quote | #6D6259 | italic |
| punctuation.definition.list.begin.markdown | #A2546E | — |
| support.type.property-name.json | #A2546E | — |
| string.quoted.double.json | #C9A86C | — |
| entity.name.tag.yaml | #A2546E | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python, variable.language.special.self.python | #C4728A | italic |
| support.function.builtin.python, support.type.python | #8B9EB0 | — |
| support.function.magic.python | #9B7BB0 | italic |
| entity.name.function.decorator.python, meta.function.decorator.python | #9B7BB0 | — |
| string.quoted.docstring.multi.python, string.quoted.docstring.single.python | #6D6259 | italic |
| constant.character.format.placeholder.other.python | #A2546E | — |
| punctuation.definition.lifetime.rust, entity.name.lifetime.rust, storage.modifier.lifetime.rust | #C4728A | italic |
| entity.name.function.macro.rust, support.macro.rust, meta.macro.rust | #9B7BB0 | — |
| meta.attribute.rust, punctuation.definition.attribute.rust, punctuation.brackets.attribute.rust | #6B9B9B | — |
| keyword.other.unsafe.rust | #C4728A | bold |
| storage.modifier.mut.rust | #A2546E | italic |
| entity.name.type.rust, entity.name.type.primitive.rust, support.type.primitive.rust | #6B9B9B | — |
| entity.name.type.trait.rust | #6B9B9B | italic |
| keyword.other.impl.rust | #A2546E | italic |
| variable.language.self.rust | #C4728A | italic |
| entity.name.module.rust, entity.name.namespace.rust | #6B9B9B | — |
| variable.language.this | #C4728A | italic |
| support.type.primitive.ts, support.type.builtin.ts | #6B9B9B | — |
| entity.name.package.go | #6B9B9B | — |
| support.function.builtin.go | #8B9EB0 | — |
| keyword.control.directive.include, keyword.control.directive.define, keyword.control.directive.conditional, meta.preprocessor | #9B7BB0 | — |
| support.type.sys-types.c, support.type.sys-types.cpp, storage.type.built-in.c, storage.type.built-in.cpp | #6B9B9B | — |
| support.function | #8B9EB0 | — |
| support.class | #6B9B9B | — |
| support.constant | #D4B483 | — |
| entity.name | #6B9B9B | — |
| entity.name.namespace, entity.name.module | #6B9B9B | — |
| invalid | #C4728A | underline |
| invalid.deprecated | #6D6259 | strikethrough |
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 |
|---|---|---|
| emphasis | — | italic |
| strong | — | bold |
| header | #A2546E | — |
| comment, punctuation.definition.comment | #6D6259 | italic |
| comment keyword.codetag.notation, comment.block.documentation keyword, storage.type.class.jsdoc | #9B7BB0 | — |
| comment.block.documentation variable.other, comment.block.documentation entity.name.type | #6B9B9B | italic |
| string | #C9A86C | — |
| punctuation.definition.string.begin, punctuation.definition.string.end | #A68B52 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end | #A2546E | — |
| meta.template.expression | #E8E0D8 | — |
| constant, variable.other.constant | #D4B483 | — |
| constant.numeric | #9B7BB0 | — |
| constant.language.boolean | #C4728A | — |
| constant.language.null, constant.language.undefined | #C4728A | italic |
| keyword | #A2546E | — |
| storage.type, storage.modifier | #A2546E | italic |
| keyword.control | #A2546E | — |
| keyword.control.import, keyword.control.export, keyword.control.from | #A2546E | italic |
| entity.name.function, meta.function-call | #8B9EB0 | — |
| variable.parameter | #D4B483 | italic |
| storage.type.function.arrow | #A2546E | — |
| entity.name.type.class, entity.name.class | #6B9B9B | bold |
| entity.name.type.interface | #6B9B9B | italic |
| entity.name.type, support.type | #6B9B9B | italic |
| entity.name.type.parameter | #D4B483 | — |
| variable | #E8E0D8 | — |
| variable.language | #C4728A | italic |
| variable.other.property, meta.object-literal.key | #B0A59A | — |
| entity.name.tag | #A2546E | — |
| entity.other.attribute-name | #D4B483 | italic |
| string.quoted.double.html, string.quoted.single.html | #C9A86C | — |
| meta.selector, entity.other.attribute-name.class.css, entity.other.attribute-name.id.css | #6B9B9B | — |
| support.type.property-name.css | #8B9EB0 | — |
| support.constant.property-value.css, meta.property-value.css | #D4B483 | — |
| keyword.other.unit.css | #9B7BB0 | — |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #A2546E | — |
| keyword.operator | #A2546E | — |
| keyword.operator.comparison, keyword.operator.relational | #6B9B9B | — |
| keyword.operator.logical | #A2546E | — |
| punctuation | #B0A59A | — |
| punctuation.definition.block, meta.brace | #B0A59A | — |
| string.regexp | #C4728A | — |
| punctuation.definition.group.regexp, keyword.operator.quantifier.regexp | #9B7BB0 | — |
| meta.decorator, punctuation.decorator | #9B7BB0 | — |
| markup.heading, heading.1.markdown, heading.2.markdown, heading.3.markdown | #A2546E | bold |
| markup.bold | #D4B483 | bold |
| markup.italic | #9B7BB0 | italic |
| markup.underline.link, string.other.link | #8B9EB0 | — |
| markup.inline.raw, markup.fenced_code.block | #C9A86C | — |
| markup.quote | #6D6259 | italic |
| punctuation.definition.list.begin.markdown | #A2546E | — |
| support.type.property-name.json | #A2546E | — |
| string.quoted.double.json | #C9A86C | — |
| entity.name.tag.yaml | #A2546E | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python, variable.language.special.self.python | #C4728A | italic |
| support.function.builtin.python, support.type.python | #8B9EB0 | — |
| support.function.magic.python | #9B7BB0 | italic |
| entity.name.function.decorator.python, meta.function.decorator.python | #9B7BB0 | — |
| string.quoted.docstring.multi.python, string.quoted.docstring.single.python | #6D6259 | italic |
| constant.character.format.placeholder.other.python | #A2546E | — |
| punctuation.definition.lifetime.rust, entity.name.lifetime.rust, storage.modifier.lifetime.rust | #C4728A | italic |
| entity.name.function.macro.rust, support.macro.rust, meta.macro.rust | #9B7BB0 | — |
| meta.attribute.rust, punctuation.definition.attribute.rust, punctuation.brackets.attribute.rust | #6B9B9B | — |
| keyword.other.unsafe.rust | #C4728A | bold |
| storage.modifier.mut.rust | #A2546E | italic |
| entity.name.type.rust, entity.name.type.primitive.rust, support.type.primitive.rust | #6B9B9B | — |
| entity.name.type.trait.rust | #6B9B9B | italic |
| keyword.other.impl.rust | #A2546E | italic |
| variable.language.self.rust | #C4728A | italic |
| entity.name.module.rust, entity.name.namespace.rust | #6B9B9B | — |
| variable.language.this | #C4728A | italic |
| support.type.primitive.ts, support.type.builtin.ts | #6B9B9B | — |
| entity.name.package.go | #6B9B9B | — |
| support.function.builtin.go | #8B9EB0 | — |
| keyword.control.directive.include, keyword.control.directive.define, keyword.control.directive.conditional, meta.preprocessor | #9B7BB0 | — |
| support.type.sys-types.c, support.type.sys-types.cpp, storage.type.built-in.c, storage.type.built-in.cpp | #6B9B9B | — |
| support.function | #8B9EB0 | — |
| support.class | #6B9B9B | — |
| support.constant | #D4B483 | — |
| entity.name | #6B9B9B | — |
| entity.name.namespace, entity.name.module | #6B9B9B | — |
| invalid | #C4728A | underline |
| invalid.deprecated | #6D6259 | strikethrough |
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 |
|---|---|---|
| emphasis | — | italic |
| strong | — | bold |
| header | #A2546E | — |
| comment, punctuation.definition.comment | #6D6259 | italic |
| comment keyword.codetag.notation, comment.block.documentation keyword, storage.type.class.jsdoc | #9B7BB0 | — |
| comment.block.documentation variable.other, comment.block.documentation entity.name.type | #6B9B9B | italic |
| string | #C9A86C | — |
| punctuation.definition.string.begin, punctuation.definition.string.end | #A68B52 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end | #A2546E | — |
| meta.template.expression | #E8E0D8 | — |
| constant, variable.other.constant | #D4B483 | — |
| constant.numeric | #9B7BB0 | — |
| constant.language.boolean | #C4728A | — |
| constant.language.null, constant.language.undefined | #C4728A | italic |
| keyword | #A2546E | — |
| storage.type, storage.modifier | #A2546E | italic |
| keyword.control | #A2546E | — |
| keyword.control.import, keyword.control.export, keyword.control.from | #A2546E | italic |
| entity.name.function, meta.function-call | #8B9EB0 | — |
| variable.parameter | #D4B483 | italic |
| storage.type.function.arrow | #A2546E | — |
| entity.name.type.class, entity.name.class | #6B9B9B | bold |
| entity.name.type.interface | #6B9B9B | italic |
| entity.name.type, support.type | #6B9B9B | italic |
| entity.name.type.parameter | #D4B483 | — |
| variable | #E8E0D8 | — |
| variable.language | #C4728A | italic |
| variable.other.property, meta.object-literal.key | #B0A59A | — |
| entity.name.tag | #A2546E | — |
| entity.other.attribute-name | #D4B483 | italic |
| string.quoted.double.html, string.quoted.single.html | #C9A86C | — |
| meta.selector, entity.other.attribute-name.class.css, entity.other.attribute-name.id.css | #6B9B9B | — |
| support.type.property-name.css | #8B9EB0 | — |
| support.constant.property-value.css, meta.property-value.css | #D4B483 | — |
| keyword.other.unit.css | #9B7BB0 | — |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #A2546E | — |
| keyword.operator | #A2546E | — |
| keyword.operator.comparison, keyword.operator.relational | #6B9B9B | — |
| keyword.operator.logical | #A2546E | — |
| punctuation | #B0A59A | — |
| punctuation.definition.block, meta.brace | #B0A59A | — |
| string.regexp | #C4728A | — |
| punctuation.definition.group.regexp, keyword.operator.quantifier.regexp | #9B7BB0 | — |
| meta.decorator, punctuation.decorator | #9B7BB0 | — |
| markup.heading, heading.1.markdown, heading.2.markdown, heading.3.markdown | #A2546E | bold |
| markup.bold | #D4B483 | bold |
| markup.italic | #9B7BB0 | italic |
| markup.underline.link, string.other.link | #8B9EB0 | — |
| markup.inline.raw, markup.fenced_code.block | #C9A86C | — |
| markup.quote | #6D6259 | italic |
| punctuation.definition.list.begin.markdown | #A2546E | — |
| support.type.property-name.json | #A2546E | — |
| string.quoted.double.json | #C9A86C | — |
| entity.name.tag.yaml | #A2546E | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python, variable.language.special.self.python | #C4728A | italic |
| support.function.builtin.python, support.type.python | #8B9EB0 | — |
| support.function.magic.python | #9B7BB0 | italic |
| entity.name.function.decorator.python, meta.function.decorator.python | #9B7BB0 | — |
| string.quoted.docstring.multi.python, string.quoted.docstring.single.python | #6D6259 | italic |
| constant.character.format.placeholder.other.python | #A2546E | — |
| punctuation.definition.lifetime.rust, entity.name.lifetime.rust, storage.modifier.lifetime.rust | #C4728A | italic |
| entity.name.function.macro.rust, support.macro.rust, meta.macro.rust | #9B7BB0 | — |
| meta.attribute.rust, punctuation.definition.attribute.rust, punctuation.brackets.attribute.rust | #6B9B9B | — |
| keyword.other.unsafe.rust | #C4728A | bold |
| storage.modifier.mut.rust | #A2546E | italic |
| entity.name.type.rust, entity.name.type.primitive.rust, support.type.primitive.rust | #6B9B9B | — |
| entity.name.type.trait.rust | #6B9B9B | italic |
| keyword.other.impl.rust | #A2546E | italic |
| variable.language.self.rust | #C4728A | italic |
| entity.name.module.rust, entity.name.namespace.rust | #6B9B9B | — |
| variable.language.this | #C4728A | italic |
| support.type.primitive.ts, support.type.builtin.ts | #6B9B9B | — |
| entity.name.package.go | #6B9B9B | — |
| support.function.builtin.go | #8B9EB0 | — |
| keyword.control.directive.include, keyword.control.directive.define, keyword.control.directive.conditional, meta.preprocessor | #9B7BB0 | — |
| support.type.sys-types.c, support.type.sys-types.cpp, storage.type.built-in.c, storage.type.built-in.cpp | #6B9B9B | — |
| support.function | #8B9EB0 | — |
| support.class | #6B9B9B | — |
| support.constant | #D4B483 | — |
| entity.name | #6B9B9B | — |
| entity.name.namespace, entity.name.module | #6B9B9B | — |
| invalid | #C4728A | underline |
| invalid.deprecated | #6D6259 | strikethrough |
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 |
|---|---|---|
| emphasis | — | italic |
| strong | — | bold |
| header | #6B9B9B | — |
| comment, punctuation.definition.comment | #6D6259 | italic |
| comment keyword.codetag.notation, comment.block.documentation keyword, storage.type.class.jsdoc | #9B7BB0 | — |
| comment.block.documentation variable.other, comment.block.documentation entity.name.type | #6B9B9B | italic |
| string | #C9A86C | — |
| punctuation.definition.string.begin, punctuation.definition.string.end | #A68B52 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end | #6B9B9B | — |
| meta.template.expression | #E8E0D8 | — |
| constant, variable.other.constant | #D4B483 | — |
| constant.numeric | #9B7BB0 | — |
| constant.language.boolean | #C4728A | — |
| constant.language.null, constant.language.undefined | #C4728A | italic |
| keyword | #A2546E | — |
| storage.type, storage.modifier | #A2546E | italic |
| keyword.control | #A2546E | — |
| keyword.control.import, keyword.control.export, keyword.control.from | #A2546E | italic |
| entity.name.function, meta.function-call | #8B9EB0 | — |
| variable.parameter | #D4B483 | italic |
| storage.type.function.arrow | #A2546E | — |
| entity.name.type.class, entity.name.class | #6B9B9B | bold |
| entity.name.type.interface | #6B9B9B | italic |
| entity.name.type, support.type | #6B9B9B | italic |
| entity.name.type.parameter | #D4B483 | — |
| variable | #E8E0D8 | — |
| variable.language | #C4728A | italic |
| variable.other.property, meta.object-literal.key | #B0A59A | — |
| entity.name.tag | #A2546E | — |
| entity.other.attribute-name | #D4B483 | italic |
| string.quoted.double.html, string.quoted.single.html | #C9A86C | — |
| meta.selector, entity.other.attribute-name.class.css, entity.other.attribute-name.id.css | #6B9B9B | — |
| support.type.property-name.css | #8B9EB0 | — |
| support.constant.property-value.css, meta.property-value.css | #D4B483 | — |
| keyword.other.unit.css | #9B7BB0 | — |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #A2546E | — |
| keyword.operator | #A2546E | — |
| keyword.operator.comparison, keyword.operator.relational | #6B9B9B | — |
| keyword.operator.logical | #A2546E | — |
| punctuation | #B0A59A | — |
| punctuation.definition.block, meta.brace | #B0A59A | — |
| string.regexp | #C4728A | — |
| punctuation.definition.group.regexp, keyword.operator.quantifier.regexp | #9B7BB0 | — |
| meta.decorator, punctuation.decorator | #9B7BB0 | — |
| markup.heading, heading.1.markdown, heading.2.markdown, heading.3.markdown | #6B9B9B | bold |
| markup.bold | #D4B483 | bold |
| markup.italic | #9B7BB0 | italic |
| markup.underline.link, string.other.link | #8B9EB0 | — |
| markup.inline.raw, markup.fenced_code.block | #C9A86C | — |
| markup.quote | #6D6259 | italic |
| punctuation.definition.list.begin.markdown | #6B9B9B | — |
| support.type.property-name.json | #A2546E | — |
| string.quoted.double.json | #C9A86C | — |
| entity.name.tag.yaml | #A2546E | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python, variable.language.special.self.python | #C4728A | italic |
| support.function.builtin.python, support.type.python | #8B9EB0 | — |
| support.function.magic.python | #9B7BB0 | italic |
| entity.name.function.decorator.python, meta.function.decorator.python | #9B7BB0 | — |
| string.quoted.docstring.multi.python, string.quoted.docstring.single.python | #6D6259 | italic |
| constant.character.format.placeholder.other.python | #6B9B9B | — |
| punctuation.definition.lifetime.rust, entity.name.lifetime.rust, storage.modifier.lifetime.rust | #C4728A | italic |
| entity.name.function.macro.rust, support.macro.rust, meta.macro.rust | #9B7BB0 | — |
| meta.attribute.rust, punctuation.definition.attribute.rust, punctuation.brackets.attribute.rust | #6B9B9B | — |
| keyword.other.unsafe.rust | #C4728A | bold |
| storage.modifier.mut.rust | #A2546E | italic |
| entity.name.type.rust, entity.name.type.primitive.rust, support.type.primitive.rust | #6B9B9B | — |
| entity.name.type.trait.rust | #6B9B9B | italic |
| keyword.other.impl.rust | #A2546E | italic |
| variable.language.self.rust | #C4728A | italic |
| entity.name.module.rust, entity.name.namespace.rust | #6B9B9B | — |
| variable.language.this | #C4728A | italic |
| support.type.primitive.ts, support.type.builtin.ts | #6B9B9B | — |
| entity.name.package.go | #6B9B9B | — |
| support.function.builtin.go | #8B9EB0 | — |
| keyword.control.directive.include, keyword.control.directive.define, keyword.control.directive.conditional, meta.preprocessor | #9B7BB0 | — |
| support.type.sys-types.c, support.type.sys-types.cpp, storage.type.built-in.c, storage.type.built-in.cpp | #6B9B9B | — |
| support.function | #8B9EB0 | — |
| support.class | #6B9B9B | — |
| support.constant | #D4B483 | — |
| entity.name | #6B9B9B | — |
| entity.name.namespace, entity.name.module | #6B9B9B | — |
| invalid | #C4728A | underline |
| invalid.deprecated | #6D6259 | strikethrough |
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}!`;
}
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}!`;
}
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}!`;
}
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}!`;
}