SLab Theme
All themes in one place
All themes in one place
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 |
|---|---|---|
| — | #24292e | — |
| comment | #6a737d | — |
| string | #032f62 | — |
| constant.numeric | #032f62 | — |
| constant.language | #005cc5 | — |
| constant.character, constant.other | #005cc5 | — |
| variable | — | |
| keyword | #d73a49 | — |
| storage | #005cc5 | |
| storage.type | #d73a49 | |
| entity.name.class | #005cc5 | underline |
| entity.other.inherited-class | #005cc5 | |
| entity.name.function | #005cc5 | |
| variable.parameter | #24292e | |
| entity.name.tag | #d73a49 | |
| entity.other.attribute-name | #005cc5 | |
| support.function | #6f42c1 | |
| support.constant | #005cc5 | |
| support.type, support.class | #005cc5 | |
| support.other.variable | — | |
| invalid | #cf433e | |
| invalid.deprecated | #cf433e | — |
| meta.structure.dictionary.json string.quoted.double.json | #032f62 | — |
| meta.diff, meta.diff.header | #6a737d | — |
| markup.deleted | #e61f44 | — |
| markup.inserted | #A6E22E | — |
| markup.changed | #f7b83d | — |
| constant.numeric.line-number.find-in-files - match | #8FBE00A0 | — |
| entity.name.filename.find-in-files | #E6DB74 | — |
| keyword.other | #474d54 | — |
| meta.property-value, support.constant.property-value, constant.other.color | #032f62 | — |
| meta.structure.dictionary.json string.quoted.double.json | #005cc5 | — |
| meta.structure.dictionary.value.json string.quoted.double.json | #032f62 | — |
| meta.property-name support.type.property-name | — | normal |
| meta.property-value punctuation.separator.key-value | #24292e | — |
| keyword.other.use, keyword.other.function.use, keyword.other.namespace, keyword.other.new, keyword.other.special-method, keyword.other.unit, keyword.other.use-as | #d73a49 | — |
| meta.use support.class.builtin, meta.other.inherited-class support.class.builtin | #d73a49 | normal |
| variable.other | #24292e | normal |
| variable.parameter.function.coffee | #032f62 | |
| entity.name.section.markdown | #005cc5 | — |
| punctuation.definition.heading.markdown | #d73a49 | — |
| markup.raw.inline.markdown | #032f62 | — |
| punctuation.definition.bold.markdown, punctuation.definition.italic.markdown | #d73a49 | — |
| punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown | #d73a49 | — |
| punctuation.definition.metadata.markdown | #d73a49 | — |
| markup.underline.link.markdown, markup.underline.link.image.markdown, meta.image.inline.markdown | #d73a49 | |
| markup.bold.markdown, markup.italic.markdown | #d73a49 | — |
| markup.italic.markdown | — | italic |
| markup.bold.markdown | — | bold |
| markup.raw.block.markdown | #664e4d | — |
| markup.deleted.git_gutter | #e61f44 | — |
| markup.inserted.git_gutter | #a7da1e | — |
| markup.changed.git_gutter | #f7b83d | — |
| meta.template.expression | #24292e | — |
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 |
|---|---|---|
| — | #ffffff | — |
| comment | #718493 | — |
| string | #9fbde0 | — |
| constant.numeric | #9fbde0 | — |
| constant.language | #5392db | — |
| constant.character, constant.other | #5392db | — |
| variable | — | |
| keyword | #e85362 | — |
| storage | #5392db | |
| storage.type | #e85362 | |
| entity.name.class | #5392db | underline |
| entity.other.inherited-class | #5392db | |
| entity.name.function | #5392db | |
| variable.parameter | #ffffff | |
| entity.name.tag | #e85362 | |
| entity.other.attribute-name | #5392db | |
| support.function | #9b78db | |
| support.constant | #5392db | |
| support.type, support.class | #5392db | |
| support.other.variable | — | |
| invalid | #cf433e | |
| invalid.deprecated | #cf433e | — |
| meta.structure.dictionary.json string.quoted.double.json | #9fbde0 | — |
| meta.diff, meta.diff.header | #718493 | — |
| markup.deleted | #e61f44 | — |
| markup.inserted | #A6E22E | — |
| markup.changed | #f7b83d | — |
| constant.numeric.line-number.find-in-files - match | #8FBE00A0 | — |
| entity.name.filename.find-in-files | #E6DB74 | — |
| keyword.other | #9caab4 | — |
| meta.property-value, support.constant.property-value, constant.other.color | #9fbde0 | — |
| meta.structure.dictionary.json string.quoted.double.json | #5392db | — |
| meta.structure.dictionary.value.json string.quoted.double.json | #9fbde0 | — |
| meta.property-name support.type.property-name | — | normal |
| meta.property-value punctuation.separator.key-value | #ffffff | — |
| keyword.other.use, keyword.other.function.use, keyword.other.namespace, keyword.other.new, keyword.other.special-method, keyword.other.unit, keyword.other.use-as | #e85362 | — |
| meta.use support.class.builtin, meta.other.inherited-class support.class.builtin | #e85362 | normal |
| variable.other | #ffffff | normal |
| variable.parameter.function.coffee | #9fbde0 | |
| entity.name.section.markdown | #5392db | — |
| punctuation.definition.heading.markdown | #e85362 | — |
| markup.raw.inline.markdown | #9fbde0 | — |
| punctuation.definition.bold.markdown, punctuation.definition.italic.markdown | #e85362 | — |
| punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown | #e85362 | — |
| punctuation.definition.metadata.markdown | #e85362 | — |
| markup.underline.link.markdown, markup.underline.link.image.markdown, meta.image.inline.markdown | #e85362 | |
| markup.bold.markdown, markup.italic.markdown | #e85362 | — |
| markup.italic.markdown | — | italic |
| markup.bold.markdown | — | bold |
| markup.raw.block.markdown | #664e4d | — |
| markup.deleted.git_gutter | #e61f44 | — |
| markup.inserted.git_gutter | #a7da1e | — |
| markup.changed.git_gutter | #f7b83d | — |
| meta.template.expression | #ffffff | — |
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 | #878580 | — |
| comment.block.documentation, comment.block.documentation variable.other | #878580 | italic |
| comment.block.documentation entity.name.type | #CECDC3 | — |
| comment.block.documentation storage.type | #878580 | italic |
| string, punctuation.definition.string.template | #3AA99F | — |
| constant.numeric | #D0A215 | — |
| constant.language | #D0A215 | — |
| constant.character, constant.other | #3AA99F | — |
| variable.language.this | #4385BE | — |
| keyword, keyword.operator.new, storage.modifier.async, keyword.operator.less | #CE5D97 | bold |
| keyword.operator | #CECDC3 | |
| punctuation | #CECDC3 | — |
| punctuation.definition.comment | #878580 | |
| punctuation.definition.tag | #CECDC3 | |
| string.quoted punctuation.definition.string | #3AA99F | |
| string.regexp, string.regexp punctuation.definition.string | #3AA99F | |
| storage | #CE5D97 | |
| storage.type | #CE5D97 | bold |
| entity.name.class | #4385BE | underline |
| entity.name.function, meta.require, support.function.any-method, variable.function, support.function.builtin.python, meta.function-call.generic.python | #4385BE | bold |
| keyword.operator.assignment, keyword.operator.arithmetic, keyword.operator.bitwise, keyword.operator.relational, keyword.operator.increment, keyword.operator.decrement, keyword.operator.logical, keyword.operator.comparison, keyword.operator.ternary, keyword.operator.expression | #4385BE | — |
| variable.parameter | #CECDC3 | |
| source.css.scss, source.css | #3AA99F | |
| entity.other.attribute-name | #D0A215 | |
| support.function, support.variable.dom | #D0A215 | |
| support.constant | #3AA99F | |
| support.type | #CECDC3 | |
| support.class | #3AA99F | |
| invalid | #D14D41 | |
| invalid.deprecated | #D14D41 | — |
| invalid.illegal | #878580 | — |
| meta.diff, meta.diff.header | #878580 | — |
| markup.deleted | #D14D41 | — |
| markup.inserted | #879A39 | — |
| markup.changed | #D0A215 | — |
| constant.numeric.line-number.find-in-files - match | #879A39 | — |
| entity.name.filename.find-in-files | #D0A215 | — |
| keyword.other | #CECDC3 | — |
| meta.property-value, support.constant.property-value, constant.other.color | #4385BE | — |
| meta.property-value punctuation.separator.key-value | #878580 | — |
| keyword.other.use, keyword.other.function.use, keyword.other.namespace, keyword.other.new, keyword.other.special-method, keyword.other.unit, keyword.other.use-as | #CE5D97 | — |
| meta.use support.class.builtin, meta.other.inherited-class support.class.builtin | #CE5D97 | normal |
| variable.other | #CECDC3 | normal |
| meta.object-literal.key | #CE5D97 | normal |
| variable.parameter.function.coffee | #4385BE | |
| markup.deleted.git_gutter | #D14D41 | — |
| markup.inserted.git_gutter | — | — |
| markup.changed.git_gutter | #D0A215 | — |
| meta.template.expression | #4385BE | — |
| variable.other.constant.property, keyword.operator.ternary, keyword.operator.expression.typeof | #8B7EC8 | — |
| entity.name.type, support.type.python | #D0A215 | — |
| token.info-token | #4385BE | — |
| token.warn-token | #D0A215 | — |
| token.error-token | #D14D41 | — |
| token.debug-token | #8B7EC8 | — |
| entity.name.tag.tsx, entity.name.tag.js.jsx, entity.name.tag.html, entity.name.tag.xml, entity.name.tag.script.html.vue, entity.name.tag.template.html.vue, entity.name.tag.style.html.vue, entity.name.tag.style.html.vue, entity.name.tag.script.html, entity.name.tag.template.html, entity.name.tag.style.html, entity.name.tag.block.any.html | #4385BE | |
| support.class.component.tsx, support.class.component.jsx | #CE5D97 | |
| support.type.primitive.tsx, support.type.primitive.ts | #CE5D97 | — |
| storage.modifier.tsx | #CE5D97 | — |
| entity.other.inherited-class.tsx | #D0A215 | — |
| meta.object.member variable.other.readwrite.tsx | #CECDC3 | — |
| meta.structure.dictionary.json string.quoted.double.json | #878580 | — |
| meta.structure.dictionary.value.json string.quoted.double.json | #3AA99F | — |
| meta.structure.dictionary.json, punctuation.definition.string | #3AA99F | — |
| meta.structure.dictionary.json, support.type.property-name.json | #CE5D97 | — |
| punctuation.definition.list.begin.markdown, punctuation.definition.list.begin.mdx, punctuation.definition.list.end.markdown, punctuation.definition.list.end.mdx, punctuation.definition.quote.begin.markdown, punctuation.definition.quote.begin.mdx, punctuation.definition.quote.end.markdown, punctuation.definition.quote.end.mdx, meta.separator.markdown, meta.separator.mdx, markup.inline.raw.string.markdown, markup.raw.code.text.mdx | #D0A215 | — |
| entity.name.section.markdown, entity.name.section.mdx | #D0A215 | bold |
| punctuation.definition.heading.markdown, punctuation.definition.heading.mdx | #CE5D97 | bold |
| markup.raw.inline.markdown, markup.raw.inline.mdx | #4385BE | — |
| punctuation.definition.bold.markdown, punctuation.definition.bold.mdx, punctuation.definition.italic.markdown, punctuation.definition.italic.mdx, punctuation.definition.entity | #CE5D97 | — |
| punctuation.definition.string.begin.markdown, punctuation.definition.string.begin.mdx, punctuation.definition.string.end.markdown, punctuation.definition.string.end.mdx | #CE5D97 | — |
| punctuation.definition.metadata.markdown, punctuation.definition.metadata.mdx | #CE5D97 | — |
| markup.underline.link.markdown, markup.underline.link.image.markdown, string.other.link.destination.mdx, meta.image.inline.markdown, meta.image.inline.mdx | #CE5D97 | |
| markup.bold.markdown, string.other.strong.asterisk.mdx, markup.italic.markdown, markup.italic.mdx | #CE5D97 | — |
| markup.italic.markdown, markup.italic.mdx | — | italic |
| markup.bold.markdown, markup.bold.mdx | — | bold |
| markup.raw.block.markdown, markup.raw.block.mdx | #4385BE | — |
| keyword.other.rust | #8B7EC8 | — |
| keyword.other.fn.rust | #CE5D97 | — |
| punctuation.section.embedded.begin.php, keyword.other.class.php | #CE5D97 | — |
| support.class.php | #CECDC3 | — |
| meta.use.php | #879A39 | — |
| keyword.other.definition.ini | #D0A215 | — |
| support.type.primitive.prisma | #D0A215 | — |
| support.constant.constant.prisma | #CE5D97 | — |
| variable.language.relations.prisma | #879A39 | — |
| entity.name.tag.yaml | #CE5D97 | — |
| storage.type.java | #D0A215 | bold |
| keyword.other.package.java, keyword.other.import.java | #CE5D97 | bold |
| storage.modifier.package.java | #D0A215 | — |
| storage.modifier.import.java | #878580 | — |
| punctuation.separator.java | #CECDC3 | — |
| meta.tag.xml | #3AA99F | — |
| keyword.other.declaration-specifier.swift, keyword.other.declaration-specifier.accessibility.swift | #CE5D97 | bold |
| support.type.swift, meta.function-result.swift, variable.language.swift, keyword.operator.custom.infix.swift | #D0A215 | — |
| variable.parameter.function.swift | #878580 | — |
| entity.name.function.swift | #D0A215 | bold |
| variable.parameter.function.swift, meta.parameter-clause.swift | #878580 | — |
| support.function.go | #3AA99F | bold |
| keyword.operator.address.go, keyword.operator.pointer.go | #D0A215 | — |
| keyword.channel.go | #8B7EC8 | — |
| storage.type.numeric.go, storage.type.string.go, storage.type.error.go, storage.type.boolean.go, storage.type.byte.go, storage.type.uintptr.go, storage.type.error.go, storage.type.rune.go, storage.type.complex.go | #D0A215 | — |
| entity.name.tag.astro | #4385BE | — |
| support.class.component.astro | #CE5D97 |
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 | #6F6E69 | — |
| comment.block.documentation, comment.block.documentation variable.other | #6F6E69 | italic |
| comment.block.documentation entity.name.type | #100F0F | — |
| comment.block.documentation storage.type | #6F6E69 | italic |
| string, punctuation.definition.string.template | #24837B | — |
| constant.numeric | #AD8301 | — |
| constant.language | #AD8301 | — |
| constant.character, constant.other | #24837B | — |
| variable.language.this | #205EA6 | — |
| keyword, keyword.operator.new, storage.modifier.async, keyword.operator.less | #A02F6F | bold |
| keyword.operator | #100F0F | |
| punctuation | #100F0F | — |
| punctuation.definition.comment | #6F6E69 | |
| punctuation.definition.tag | #100F0F | |
| string.quoted punctuation.definition.string | #24837B | |
| string.regexp, string.regexp punctuation.definition.string | #24837B | |
| storage | #A02F6F | |
| storage.type | #A02F6F | bold |
| entity.name.class | #205EA6 | underline |
| entity.name.function, meta.require, support.function.any-method, variable.function, support.function.builtin.python, meta.function-call.generic.python | #205EA6 | bold |
| keyword.operator.assignment, keyword.operator.arithmetic, keyword.operator.bitwise, keyword.operator.relational, keyword.operator.increment, keyword.operator.decrement, keyword.operator.logical, keyword.operator.comparison, keyword.operator.ternary, keyword.operator.expression | #205EA6 | — |
| variable.parameter | #100F0F | |
| source.css.scss, source.css | #24837B | |
| entity.other.attribute-name | #AD8301 | |
| support.function, support.variable.dom | #AD8301 | |
| support.constant | #24837B | |
| support.type | #100F0F | |
| support.class | #24837B | |
| invalid | #AF3029 | |
| invalid.deprecated | #AF3029 | — |
| invalid.illegal | #6F6E69 | — |
| meta.diff, meta.diff.header | #6F6E69 | — |
| markup.deleted | #AF3029 | — |
| markup.inserted | #66800B | — |
| markup.changed | #AD8301 | — |
| constant.numeric.line-number.find-in-files - match | #66800B | — |
| entity.name.filename.find-in-files | #AD8301 | — |
| keyword.other | #100F0F | — |
| meta.property-value, support.constant.property-value, constant.other.color | #205EA6 | — |
| meta.property-value punctuation.separator.key-value | #6F6E69 | — |
| keyword.other.use, keyword.other.function.use, keyword.other.namespace, keyword.other.new, keyword.other.special-method, keyword.other.unit, keyword.other.use-as | #A02F6F | — |
| meta.use support.class.builtin, meta.other.inherited-class support.class.builtin | #A02F6F | normal |
| variable.other | #100F0F | normal |
| meta.object-literal.key | #A02F6F | normal |
| variable.parameter.function.coffee | #205EA6 | |
| markup.deleted.git_gutter | #AF3029 | — |
| markup.inserted.git_gutter | — | — |
| markup.changed.git_gutter | #AD8301 | — |
| meta.template.expression | #205EA6 | — |
| variable.other.constant.property, keyword.operator.ternary, keyword.operator.expression.typeof | #5E409D | — |
| entity.name.type, support.type.python | #AD8301 | — |
| token.info-token | #205EA6 | — |
| token.warn-token | #AD8301 | — |
| token.error-token | #AF3029 | — |
| token.debug-token | #5E409D | — |
| entity.name.tag.tsx, entity.name.tag.js.jsx, entity.name.tag.html, entity.name.tag.xml, entity.name.tag.script.html.vue, entity.name.tag.template.html.vue, entity.name.tag.style.html.vue, entity.name.tag.style.html.vue, entity.name.tag.script.html, entity.name.tag.template.html, entity.name.tag.style.html, entity.name.tag.block.any.html | #205EA6 | |
| support.class.component.tsx, support.class.component.jsx | #A02F6F | |
| support.type.primitive.tsx, support.type.primitive.ts | #A02F6F | — |
| storage.modifier.tsx | #A02F6F | — |
| entity.other.inherited-class.tsx | #AD8301 | — |
| meta.object.member variable.other.readwrite.tsx | #100F0F | — |
| meta.structure.dictionary.json string.quoted.double.json | #6F6E69 | — |
| meta.structure.dictionary.value.json string.quoted.double.json | #24837B | — |
| meta.structure.dictionary.json, punctuation.definition.string | #24837B | — |
| meta.structure.dictionary.json, support.type.property-name.json | #A02F6F | — |
| punctuation.definition.list.begin.markdown, punctuation.definition.list.begin.mdx, punctuation.definition.list.end.markdown, punctuation.definition.list.end.mdx, punctuation.definition.quote.begin.markdown, punctuation.definition.quote.begin.mdx, punctuation.definition.quote.end.markdown, punctuation.definition.quote.end.mdx, meta.separator.markdown, meta.separator.mdx, markup.inline.raw.string.markdown, markup.raw.code.text.mdx | #AD8301 | — |
| entity.name.section.markdown, entity.name.section.mdx | #AD8301 | bold |
| punctuation.definition.heading.markdown, punctuation.definition.heading.mdx | #A02F6F | bold |
| markup.raw.inline.markdown, markup.raw.inline.mdx | #205EA6 | — |
| punctuation.definition.bold.markdown, punctuation.definition.bold.mdx, punctuation.definition.italic.markdown, punctuation.definition.italic.mdx, punctuation.definition.entity | #A02F6F | — |
| punctuation.definition.string.begin.markdown, punctuation.definition.string.begin.mdx, punctuation.definition.string.end.markdown, punctuation.definition.string.end.mdx | #A02F6F | — |
| punctuation.definition.metadata.markdown, punctuation.definition.metadata.mdx | #A02F6F | — |
| markup.underline.link.markdown, markup.underline.link.image.markdown, string.other.link.destination.mdx, meta.image.inline.markdown, meta.image.inline.mdx | #A02F6F | |
| markup.bold.markdown, string.other.strong.asterisk.mdx, markup.italic.markdown, markup.italic.mdx | #A02F6F | — |
| markup.italic.markdown, markup.italic.mdx | — | italic |
| markup.bold.markdown, markup.bold.mdx | — | bold |
| markup.raw.block.markdown, markup.raw.block.mdx | #205EA6 | — |
| keyword.other.rust | #5E409D | — |
| keyword.other.fn.rust | #A02F6F | — |
| punctuation.section.embedded.begin.php, keyword.other.class.php | #A02F6F | — |
| support.class.php | #100F0F | — |
| meta.use.php | #66800B | — |
| keyword.other.definition.ini | #AD8301 | — |
| support.type.primitive.prisma | #AD8301 | — |
| support.constant.constant.prisma | #A02F6F | — |
| variable.language.relations.prisma | #66800B | — |
| entity.name.tag.yaml | #A02F6F | — |
| storage.type.java | #AD8301 | bold |
| keyword.other.package.java, keyword.other.import.java | #A02F6F | bold |
| storage.modifier.package.java | #AD8301 | — |
| storage.modifier.import.java | #6F6E69 | — |
| punctuation.separator.java | #100F0F | — |
| meta.tag.xml | #24837B | — |
| keyword.other.declaration-specifier.swift, keyword.other.declaration-specifier.accessibility.swift | #A02F6F | bold |
| support.type.swift, meta.function-result.swift, variable.language.swift, keyword.operator.custom.infix.swift | #AD8301 | — |
| variable.parameter.function.swift | #6F6E69 | — |
| entity.name.function.swift | #AD8301 | bold |
| variable.parameter.function.swift, meta.parameter-clause.swift | #6F6E69 | — |
| support.function.go | #24837B | bold |
| keyword.operator.address.go, keyword.operator.pointer.go | #AD8301 | — |
| keyword.channel.go | #5E409D | — |
| storage.type.numeric.go, storage.type.string.go, storage.type.error.go, storage.type.boolean.go, storage.type.byte.go, storage.type.uintptr.go, storage.type.error.go, storage.type.rune.go, storage.type.complex.go | #AD8301 | — |
| entity.name.tag.astro | #205EA6 | — |
| support.class.component.astro | #A02F6F |
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}!`;
}