Cyber Dark & Qoder Themes
A modern VSCode theme collection featuring Cyber Dark variants and modern purple/blue accent themes with clean, minimalistic design
A modern VSCode theme collection featuring Cyber Dark variants and modern purple/blue accent themes with clean, minimalistic design
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 | #64748B | italic |
| keyword, storage.type, storage.modifier | #60A5FA | — |
| keyword.control, keyword.control.conditional, keyword.control.loop, keyword.control.flow | #60A5FA | bold |
| keyword.control.flow.js, keyword.control.flow.ts, keyword.control.conditional.js, keyword.control.conditional.ts, keyword.control.loop.js, keyword.control.loop.ts | #60A5FA | bold |
| keyword.control.async.js, keyword.control.async.ts, storage.modifier.async.js, storage.modifier.async.ts | #60A5FA | bold |
| entity.name.function, support.function, meta.function-call | #A78BFA | — |
| meta.method, meta.method-call, entity.name.method | #A78BFA | — |
| storage.type.function.arrow.js, storage.type.function.arrow.ts, keyword.operator.arrow.js, keyword.operator.arrow.ts | #A78BFA | — |
| entity.name.class, entity.name.type.class, support.class, storage.type.class.js, storage.type.class.ts | #F87171 | — |
| entity.name.type, support.type, storage.type | #F87171 | — |
| entity.name.interface, entity.name.type.interface | #F87171 | — |
| variable, variable.other, variable.other.readwrite | #38BDF8 | — |
| variable.language.this.js, variable.language.this.ts, variable.language.super.js, variable.language.super.ts | #FBBF24 | bold |
| variable.other.constant, constant, constant.language, constant.numeric | #FBBF24 | — |
| string, string.quoted, string.template | #34D399 | — |
| string.template.js, string.template.ts | #34D399 | — |
| constant.numeric, constant.numeric.integer, constant.numeric.float | #FB923C | — |
| constant.language.boolean, constant.language.true, constant.language.false | #FB923C | bold |
| constant.language.null, constant.language.undefined, constant.language.nan | #FB923C | italic |
| variable.other.property, meta.property-name, support.variable.property | #38BDF8 | — |
| keyword.operator, punctuation.separator.key-value, punctuation.accessor | #60A5FA | — |
| keyword.operator.spread.js, keyword.operator.spread.ts, keyword.operator.rest.js, keyword.operator.rest.ts | #A78BFA | bold |
| punctuation, punctuation.definition, punctuation.separator, punctuation.terminator | #D1D5DB | — |
| entity.name.tag, meta.tag, punctuation.definition.tag | #60A5FA | — |
| entity.name.tag.js, entity.name.tag.tsx, entity.name.tag.jsx, support.class.component.js, support.class.component.tsx, meta.tag.js, meta.tag.tsx | #60A5FA | — |
| entity.other.attribute-name, meta.attribute-name | #38BDF8 | — |
| entity.other.attribute-name.js, entity.other.attribute-name.tsx, entity.other.attribute-name.jsx | #38BDF8 | — |
| string.quoted.double, string.quoted.single | #34D399 | — |
| meta.decorator, entity.name.decorator | #A78BFA | — |
| variable.parameter, variable.parameter.function | #38BDF8 | — |
| entity.name.label | #FBBF24 | — |
| entity.name.namespace, support.namespace | #FBBF24 | — |
| entity.name.enum, entity.name.type.enum | #FBBF24 | — |
| variable.other.enummember, constant.other.enum | #38BDF8 | — |
| entity.name.function.constructor, support.function.constructor | #A78BFA | — |
| entity.name.module, support.module | #60A5FA | — |
| keyword.control.import.js, keyword.control.import.ts, keyword.control.export.js, keyword.control.export.ts, keyword.control.from.js, keyword.control.from.ts | #60A5FA | bold |
| string.regexp | #A78BFA | — |
| constant.character.escape | #FBBF24 | — |
| invalid, invalid.illegal | #FB923C | underline |
| invalid.deprecated | #64748B | strikethrough |
| markup.heading, markup.heading entity.name, markup.heading.markdown | #60A5FA | bold |
| markup.bold, punctuation.definition.bold | #E5E7EB | bold |
| markup.italic, punctuation.definition.italic | #E5E7EB | italic |
| markup.underline.link, string.other.link | #60A5FA | underline |
| markup.raw, markup.raw.block | #34D399 | — |
| markup.list, punctuation.definition.list | #FBBF24 | — |
| markup.quote | #64748B | italic |
| entity.other.attribute-name.class, entity.other.attribute-name.id, entity.other.attribute-name.tag | #60A5FA | — |
| support.type.property-name, support.property-name | #38BDF8 | — |
| support.constant.property-value, constant.other.color | #34D399 | — |
| support.type.property-name.json, meta.key.json | #38BDF8 | — |
| meta.value.json string.quoted.double.json | #34D399 | — |
| entity.name.tag.yaml | #38BDF8 | — |
| string.unquoted.yaml | #34D399 | — |
| support.function.python, entity.name.function.python | #A78BFA | — |
| meta.decorator.python, entity.name.decorator.python | #A78BFA | — |
| variable.language.self.python, variable.language.cls.python | #FBBF24 | — |
| storage.type.annotation.java, meta.annotation.java | #A78BFA | — |
| entity.name.function.go, support.function.go | #A78BFA | — |
| entity.name.function.macro.rust, meta.macro.rust | #A78BFA | — |
| storage.modifier.lifetime.rust, entity.name.lifetime.rust | #FBBF24 | — |
| entity.name.function.shell, support.function.builtin.shell | #A78BFA | bold |
| variable.other.shell, variable.other.readwrite.shell | #38BDF8 | — |
| string.quoted.shell, string.unquoted.shell | #34D399 | — |
| variable.parameter.shell | #FBBF24 | — |
| markup.inserted.shell, string.success.shell | #34D399 | bold |
| markup.changed.shell, string.warning.shell | #FBBF24 | bold |
| markup.deleted.shell, string.error.shell | #FB923C | bold |
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 | #6B7280 | italic |
| keyword, storage.type, storage.modifier | #00F0FF | — |
| keyword.control, keyword.control.conditional, keyword.control.loop, keyword.control.flow | #00F0FF | bold |
| keyword.control.flow.js, keyword.control.flow.ts, keyword.control.conditional.js, keyword.control.conditional.ts, keyword.control.loop.js, keyword.control.loop.ts | #00F0FF | bold |
| keyword.control.async.js, keyword.control.async.ts, storage.modifier.async.js, storage.modifier.async.ts | #00F0FF | bold |
| entity.name.function, support.function, meta.function-call | #FF00FF | — |
| meta.method, meta.method-call, entity.name.method | #FF00FF | — |
| storage.type.function.arrow.js, storage.type.function.arrow.ts, keyword.operator.arrow.js, keyword.operator.arrow.ts | #FF00FF | — |
| entity.name.class, entity.name.type.class, support.class, storage.type.class.js, storage.type.class.ts | #A855F7 | — |
| entity.name.type, support.type, storage.type | #A855F7 | — |
| entity.name.interface, entity.name.type.interface | #A855F7 | — |
| variable, variable.other, variable.other.readwrite | #3B82F6 | — |
| variable.language.this.js, variable.language.this.ts, variable.language.super.js, variable.language.super.ts | #FFFF00 | bold |
| variable.other.constant, constant, constant.language, constant.numeric | #FFFF00 | — |
| string, string.quoted, string.template | #00FF9D | — |
| string.template.js, string.template.ts | #00FF9D | — |
| constant.numeric, constant.numeric.integer, constant.numeric.float | #FF6B00 | — |
| constant.language.boolean, constant.language.true, constant.language.false | #FF6B00 | bold |
| constant.language.null, constant.language.undefined, constant.language.nan | #FF6B00 | italic |
| variable.other.property, meta.property-name, support.variable.property | #3B82F6 | — |
| keyword.operator, punctuation.separator.key-value, punctuation.accessor | #00F0FF | — |
| keyword.operator.spread.js, keyword.operator.spread.ts, keyword.operator.rest.js, keyword.operator.rest.ts | #FF00FF | bold |
| punctuation, punctuation.definition, punctuation.separator, punctuation.terminator | #E5E7EB | — |
| entity.name.tag, meta.tag, punctuation.definition.tag | #00F0FF | — |
| entity.name.tag.js, entity.name.tag.tsx, entity.name.tag.jsx, support.class.component.js, support.class.component.tsx, meta.tag.js, meta.tag.tsx | #00F0FF | — |
| entity.other.attribute-name, meta.attribute-name | #3B82F6 | — |
| entity.other.attribute-name.js, entity.other.attribute-name.tsx, entity.other.attribute-name.jsx | #3B82F6 | — |
| string.quoted.double, string.quoted.single | #00FF9D | — |
| meta.decorator, entity.name.decorator | #FF00FF | — |
| variable.parameter, variable.parameter.function | #3B82F6 | — |
| entity.name.label | #FFFF00 | — |
| entity.name.namespace, support.namespace | #FFFF00 | — |
| entity.name.enum, entity.name.type.enum | #FFFF00 | — |
| variable.other.enummember, constant.other.enum | #3B82F6 | — |
| entity.name.function.constructor, support.function.constructor | #FF00FF | — |
| entity.name.module, support.module | #00F0FF | — |
| keyword.control.import.js, keyword.control.import.ts, keyword.control.export.js, keyword.control.export.ts, keyword.control.from.js, keyword.control.from.ts | #00F0FF | bold |
| string.regexp | #FF00FF | — |
| constant.character.escape | #FFFF00 | — |
| invalid, invalid.illegal | #FF6B00 | underline |
| invalid.deprecated | #6B7280 | strikethrough |
| markup.heading, markup.heading entity.name, markup.heading.markdown | #00F0FF | bold |
| markup.bold, punctuation.definition.bold | #E5E7EB | bold |
| markup.italic, punctuation.definition.italic | #E5E7EB | italic |
| markup.underline.link, string.other.link | #00F0FF | underline |
| markup.raw, markup.raw.block | #00FF9D | — |
| markup.list, punctuation.definition.list | #FFFF00 | — |
| markup.quote | #6B7280 | italic |
| entity.other.attribute-name.class, entity.other.attribute-name.id, entity.other.attribute-name.tag | #00F0FF | — |
| support.type.property-name, support.property-name | #3B82F6 | — |
| support.constant.property-value, constant.other.color | #00FF9D | — |
| support.type.property-name.json, meta.key.json | #3B82F6 | — |
| meta.value.json string.quoted.double.json | #00FF9D | — |
| entity.name.tag.yaml | #3B82F6 | — |
| string.unquoted.yaml | #00FF9D | — |
| support.function.python, entity.name.function.python | #FF00FF | — |
| meta.decorator.python, entity.name.decorator.python | #FF00FF | — |
| variable.language.self.python, variable.language.cls.python | #FFFF00 | — |
| storage.type.annotation.java, meta.annotation.java | #FF00FF | — |
| entity.name.function.go, support.function.go | #FF00FF | — |
| entity.name.function.macro.rust, meta.macro.rust | #FF00FF | — |
| storage.modifier.lifetime.rust, entity.name.lifetime.rust | #FFFF00 | — |
| entity.name.function.shell, support.function.builtin.shell | #FF00FF | bold |
| variable.other.shell, variable.other.readwrite.shell | #3B82F6 | — |
| string.quoted.shell, string.unquoted.shell | #00FF9D | — |
| variable.parameter.shell | #FFFF00 | — |
| markup.inserted.shell, string.success.shell | #00FF9D | bold |
| markup.changed.shell, string.warning.shell | #FFFF00 | bold |
| markup.deleted.shell, string.error.shell | #FF6B00 | bold |
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 | #8B949E | italic |
| keyword, storage.type, storage.modifier | #FF6B6B | — |
| keyword.control, keyword.control.conditional, keyword.control.loop, keyword.control.flow | #FF6B6B | bold |
| keyword.control.flow.js, keyword.control.flow.ts, keyword.control.conditional.js, keyword.control.conditional.ts, keyword.control.loop.js, keyword.control.loop.ts | #FF6B6B | bold |
| keyword.control.async.js, keyword.control.async.ts, storage.modifier.async.js, storage.modifier.async.ts | #FF6B6B | bold |
| entity.name.function, support.function, meta.function-call | #FFD93D | — |
| meta.method, meta.method-call, entity.name.method | #FFD93D | — |
| storage.type.function.arrow.js, storage.type.function.arrow.ts, keyword.operator.arrow.js, keyword.operator.arrow.ts | #FFD93D | — |
| entity.name.class, entity.name.type.class, support.class, storage.type.class.js, storage.type.class.ts | #EE5A24 | — |
| entity.name.type, support.type, storage.type | #EE5A24 | — |
| entity.name.interface, entity.name.type.interface | #EE5A24 | — |
| variable, variable.other, variable.other.readwrite | #FF9F43 | — |
| variable.language.this.js, variable.language.this.ts, variable.language.super.js, variable.language.super.ts | #FFEAA7 | bold |
| variable.other.constant, constant, constant.language, constant.numeric | #FFEAA7 | — |
| string, string.quoted, string.template | #6BCB77 | — |
| string.template.js, string.template.ts | #6BCB77 | — |
| constant.numeric, constant.numeric.integer, constant.numeric.float | #FF6B9D | — |
| constant.language.boolean, constant.language.true, constant.language.false | #FF6B9D | bold |
| constant.language.null, constant.language.undefined, constant.language.nan | #FF6B9D | italic |
| variable.other.property, meta.property-name, support.variable.property | #FF9F43 | — |
| keyword.operator, punctuation.separator.key-value, punctuation.accessor | #FF6B6B | — |
| keyword.operator.spread.js, keyword.operator.spread.ts, keyword.operator.rest.js, keyword.operator.rest.ts | #FFD93D | bold |
| punctuation, punctuation.definition, punctuation.separator, punctuation.terminator | #D1D5DB | — |
| entity.name.tag, meta.tag, punctuation.definition.tag | #FF6B6B | — |
| entity.name.tag.js, entity.name.tag.tsx, entity.name.tag.jsx, support.class.component.js, support.class.component.tsx, meta.tag.js, meta.tag.tsx | #FF6B6B | — |
| entity.other.attribute-name, meta.attribute-name | #FF9F43 | — |
| entity.other.attribute-name.js, entity.other.attribute-name.tsx, entity.other.attribute-name.jsx | #FF9F43 | — |
| string.quoted.double, string.quoted.single | #6BCB77 | — |
| meta.decorator, entity.name.decorator | #FFD93D | — |
| variable.parameter, variable.parameter.function | #FF9F43 | — |
| entity.name.label | #FFEAA7 | — |
| entity.name.namespace, support.namespace | #FFEAA7 | — |
| entity.name.enum, entity.name.type.enum | #FFEAA7 | — |
| variable.other.enummember, constant.other.enum | #FF9F43 | — |
| entity.name.function.constructor, support.function.constructor | #FFD93D | — |
| entity.name.module, support.module | #FF6B6B | — |
| keyword.control.import.js, keyword.control.import.ts, keyword.control.export.js, keyword.control.export.ts, keyword.control.from.js, keyword.control.from.ts | #FF6B6B | bold |
| string.regexp | #FFD93D | — |
| constant.character.escape | #FFEAA7 | — |
| invalid, invalid.illegal | #FF6B9D | underline |
| invalid.deprecated | #8B949E | strikethrough |
| markup.heading, markup.heading entity.name, markup.heading.markdown | #FF6B6B | bold |
| markup.bold, punctuation.definition.bold | #E8E8E8 | bold |
| markup.italic, punctuation.definition.italic | #E8E8E8 | italic |
| markup.underline.link, string.other.link | #FF6B6B | underline |
| markup.raw, markup.raw.block | #6BCB77 | — |
| markup.list, punctuation.definition.list | #FFEAA7 | — |
| markup.quote | #8B949E | italic |
| entity.other.attribute-name.class, entity.other.attribute-name.id, entity.other.attribute-name.tag | #FF6B6B | — |
| support.type.property-name, support.property-name | #FF9F43 | — |
| support.constant.property-value, constant.other.color | #6BCB77 | — |
| support.type.property-name.json, meta.key.json | #FF9F43 | — |
| meta.value.json string.quoted.double.json | #6BCB77 | — |
| entity.name.tag.yaml | #FF9F43 | — |
| string.unquoted.yaml | #6BCB77 | — |
| support.function.python, entity.name.function.python | #FFD93D | — |
| meta.decorator.python, entity.name.decorator.python | #FFD93D | — |
| variable.language.self.python, variable.language.cls.python | #FFEAA7 | — |
| storage.type.annotation.java, meta.annotation.java | #FFD93D | — |
| entity.name.function.go, support.function.go | #FFD93D | — |
| entity.name.function.macro.rust, meta.macro.rust | #FFD93D | — |
| storage.modifier.lifetime.rust, entity.name.lifetime.rust | #FFEAA7 | — |
| entity.name.function.shell, support.function.builtin.shell | #FFD93D | bold |
| variable.other.shell, variable.other.readwrite.shell | #FF9F43 | — |
| string.quoted.shell, string.unquoted.shell | #6BCB77 | — |
| variable.parameter.shell | #FFEAA7 | — |
| markup.inserted.shell, string.success.shell | #6BCB77 | bold |
| markup.changed.shell, string.warning.shell | #FFEAA7 | bold |
| markup.deleted.shell, string.error.shell | #FF6B9D | bold |
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 | #7A7A99 | italic |
| keyword, storage.type, storage.modifier | #8A6CFF | — |
| keyword.control, keyword.control.conditional, keyword.control.loop, keyword.control.flow | #8A6CFF | bold |
| entity.name.function, support.function, meta.function-call | #BD93F9 | — |
| meta.method, meta.method-call, entity.name.method | #BD93F9 | — |
| entity.name.class, entity.name.type.class, support.class | #FFB86C | — |
| entity.name.type, support.type, storage.type | #FFB86C | — |
| entity.name.interface, entity.name.type.interface | #FFB86C | — |
| variable, variable.other, variable.other.readwrite | #8BE9FD | — |
| variable.other.constant, constant, constant.language, constant.numeric | #FFCB8B | — |
| string, string.quoted, string.template | #50FA7B | — |
| constant.numeric, constant.numeric.integer, constant.numeric.float | #FF5555 | — |
| constant.language.boolean, constant.language.true, constant.language.false | #FF5555 | bold |
| constant.language.null, constant.language.undefined, constant.language.nan | #FF5555 | italic |
| variable.other.property, meta.property-name, support.variable.property | #8BE9FD | — |
| keyword.operator, punctuation.separator.key-value, punctuation.accessor | #8A6CFF | — |
| punctuation, punctuation.definition, punctuation.separator, punctuation.terminator | #E6E6F0 | — |
| entity.name.tag, meta.tag, punctuation.definition.tag | #8A6CFF | — |
| entity.other.attribute-name, meta.attribute-name | #8BE9FD | — |
| string.quoted.double, string.quoted.single | #50FA7B | — |
| meta.decorator, entity.name.decorator | #BD93F9 | — |
| variable.parameter, variable.parameter.function | #8BE9FD | — |
| entity.name.label | #FFB86C | — |
| entity.name.namespace, support.namespace | #FFB86C | — |
| entity.name.enum, entity.name.type.enum | #FFB86C | — |
| variable.other.enummember, constant.other.enum | #8BE9FD | — |
| entity.name.function.constructor, support.function.constructor | #BD93F9 | — |
| entity.name.module, support.module | #8A6CFF | — |
| string.regexp | #BD93F9 | — |
| constant.character.escape | #FFCB8B | — |
| invalid, invalid.illegal | #FF5555 | underline |
| invalid.deprecated | #7A7A99 | strikethrough |
| markup.heading, markup.heading entity.name, markup.heading.markdown | #8A6CFF | bold |
| markup.bold, punctuation.definition.bold | #E6E6F0 | bold |
| markup.italic, punctuation.definition.italic | #E6E6F0 | italic |
| markup.underline.link, string.other.link | #8A6CFF | underline |
| markup.raw, markup.raw.block | #50FA7B | — |
| markup.list, punctuation.definition.list | #FFB86C | — |
| markup.quote | #7A7A99 | italic |
| entity.other.attribute-name.class, entity.other.attribute-name.id, entity.other.attribute-name.tag | #8A6CFF | — |
| support.type.property-name, support.property-name | #8BE9FD | — |
| support.constant.property-value, constant.other.color | #50FA7B | — |
| support.type.property-name.json, meta.key.json | #8BE9FD | — |
| meta.value.json string.quoted.double.json | #50FA7B | — |
| entity.name.tag.yaml | #8BE9FD | — |
| string.unquoted.yaml | #50FA7B | — |
| support.function.python, entity.name.function.python | #BD93F9 | — |
| meta.decorator.python, entity.name.decorator.python | #BD93F9 | — |
| variable.language.self.python, variable.language.cls.python | #FFB86C | — |
| storage.type.js, storage.type.ts, keyword.control.flow.js, keyword.control.flow.ts | #8A6CFF | — |
| storage.type.function.arrow.js, storage.type.function.arrow.ts | #8A6CFF | — |
| string.template.js, string.template.ts | #50FA7B | — |
| entity.name.tag.js, entity.name.tag.tsx, support.class.component.js, support.class.component.tsx | #8A6CFF | — |
| storage.type.annotation.java, meta.annotation.java | #BD93F9 | — |
| entity.name.function.go, support.function.go | #BD93F9 | — |
| entity.name.function.macro.rust, meta.macro.rust | #BD93F9 | — |
| storage.modifier.lifetime.rust, entity.name.lifetime.rust | #FFB86C | — |
| entity.name.function.shell, support.function.builtin.shell | #C77DFF | bold |
| variable.other.shell, variable.other.readwrite.shell | #78D9FF | — |
| string.quoted.shell, string.unquoted.shell | #6CFF9C | — |
| variable.parameter.shell | #FFD166 | — |
| markup.inserted.shell, string.success.shell | #6CFF9C | bold |
| markup.changed.shell, string.warning.shell | #FFD166 | bold |
| markup.deleted.shell, string.error.shell | #FF6B6B | bold |
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}!`;
}