The Best Themes for programmers
Publisher: Estevam SouzaThemes in package: 127
🎨🚀 A never seen collection of 165 hand crafted themes no where to be found on Internet 💻
🎨🚀 A never seen collection of 165 hand crafted themes no where to be found on Internet 💻
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 |
|---|---|---|
| raw | #54d4ff | — |
| settings | #ffffff | — |
| variable.parameter.function | #f2f3f5 | — |
| variable | #82cbff | — |
| variable.other | #82cbff | |
| global | #ffffff | — |
| none | #D2945D | — |
| comment | #3d436951 | — |
| comment.line.double-slash | #3d436951 | — |
| comment, comment storage.type, comment variable, comment support.variable, comment support.class, comment support.type, comment entity.name.type, comment entity.name.class, comment keyword.operator, comment: comment, comment.line.double-slash, comment entity.name.class, comment entity.name.type, comment keyword.operator, comment storage.type, comment support.class, comment support.type, comment support.variable, comment variable, Double-Slashed Comment | #1782fc52 | italic |
| storage | #f90086 | — |
| storage.type | #FFF900 | — |
| quote | #777777 | italic |
| punctuation.section.array.begin.php | #abb2bf | — |
| punctuation.section.array.end.php | #abb2bf | — |
| block.scope.end,block.scope.begin | #abb2bf | — |
| punctuation.definition.string.begin, punctuation.definition.string.end | #6dee98f4 | — |
| string | #08fbcf | — |
| string.template meta.template.expression | #d3423e | — |
| constant.numeric | #Ffffff | — |
| none | #F78C6C | — |
| none | #F78C6C | — |
| constant.numeric, constant.character.numeric | #ff9748 | — |
| keyword.other.unit | #f7c66c | — |
| string.regexp, string.regexp keyword.other | #54d4ff | — |
| string.regexp | #57B6C2 | — |
| meta.selector | #CB6CFE | — |
| punctuation.section.embedded, variable.interpolation | #BE4F44 | — |
| keyword | #ff06b4 | — |
| keyword.operator.new | #f90086 | — |
| keyword.other.unit | #fff900 | — |
| keyword.operator.expression.void | #f8ec42 | — |
| meta.property-list.css meta.property-value.css variable.other.less, meta.property-list.scss variable.scss, meta.property-list.sass variable.sass, keyword.operator.logical, keyword.operator.arithmetic, keyword.operator.bitwise, keyword.operator.increment, keyword.operator.ternary, keyword.operator.comparison, keyword.operator.assignment, keyword.operator.operator, keyword.operator.or.regexp, punctuation.definintion.string, punctuation | — | |
| keyword.operator | #29c6ff | — |
| keyword.control.operator | #29c6ff | — |
| keyword.operator.arithmetic, keyword.operator.comparison, keyword.operator.arithmetic,keyword.operator.comparison,keyword.operator.expression.is | #29c6ff | — |
| keyword.operator.logical, keyword.operator.logical | #29c6ff | — |
| keyword.operator.bitwise, keyword.operator.bitwise | #29c6ff | — |
| control.elements, keyword.operator.less | #F78C6C | — |
| object.comma | #e23963b6 | — |
| none | #A6B2C0 | — |
| keyword.operator | #abb2bf | — |
| keyword.operator.assignment, keyword.operator.relational, keyword.operator, keyword.operator.bitwise, keyword.operator.comparison, keyword.operator.regexp | #f149ab | — |
| punctuation.definition.tag.html.embed.js | #ff9748 | — |
| punctuation.definition.tag, meta.tag | #29c6ff | — |
| entity.name.tag.custom | #FFF900 | — |
| entity.other.attribute-name | #FFF900 | — |
| entity.other.attribute-name.id | #FAD430 | — |
| entity.other.attribute-name.id | #61afef | — |
| entity.name.type | #f8ec42 | — |
| meta.attribute-selector.scss entity.other.attribute-name.attribute, meta.attribute-selector.sass entity.other.attribute-name.attribute | #ff9c31 | — |
| object | #cccccc | — |
| entity.other.inherited-class | #06fbcf | italic |
| entity.other.inherited-class, entity.name.class, support.class | #7a6deef4 | — |
| support.class, entity.name.type.class | #f8ec42 | — |
| entity.name.type.namespace | #f8ec42 | — |
| support.other.namespace.use.php,support.other.namespace.use-as.php,support.other.namespace.php | #f8ec42 | — |
| entity.name.class, meta.class entity.name.type.class | #FFF900 | — |
| entity.name.class.identifier.namespace.type | #f8ec42 | — |
| entity.name.class | #61afef | — |
| support.type, support.class | #FFF900 | — |
| support.function, support.constant | #54d4ff | — |
| keyword.other.special-method | #61afef | — |
| entity.name.function | #54d4ff | — |
| entity.name.function | #54d4ff | — |
| meta.function punctuation.separator.comma | #e23963b6 | — |
| function.brace | #abb2bf | — |
| function.parameter | #F78C6C | — |
| punctuation.definition.parameters | #08fbcf | — |
| variable.parameter.function | #29c6ff | — |
| variable.parameter | #ffffff | — |
| meta.function-call | #ffffff | — |
| meta.brace | #ffffff | — |
| meta.delimiter.period | #f90086 | — |
| meta.selector | #f90086 | — |
| meta.property-name | #54d4ff | — |
| meta.tag | #abb2bf | — |
| meta.cast | #e06806 | — |
| punctuation.separator, meta.block, meta.class | #feeee3 | — |
| punctuation.definition.string | #08fbcf | — |
| punctuation.section.embedded | #d3423e | — |
| punctuation.terminator.expression, punctuation.definition.arguments, punctuation.definition.array, punctuation.section.array, meta.array | #ffffff | — |
| punctuation.definition.list.begin, punctuation.definition.list.end, punctuation.separator.arguments, punctuation.definition.list | #08fbcf | — |
| punctuation.terminator | #fafaf9 | — |
| punctuation.definition.string.begin,punctuation.definition.string.end | #98c378 | — |
| constant.language.boolean | #f90086 | — |
| constant.character, constant.other | #54d4ff | — |
| support.constant.math | #FFF900 | — |
| constant.character.escape | #ff9c31 | — |
| constant.other.color.rgb-value punctuation.definition.constant | #ff9c31 | — |
| support.constant, keyword.other.special-method, keyword.other.new | #29c6ff | — |
| constant.language, punctuation.definition.constant, variable.other.constant | #ffffff | — |
| constant.other.symbol | #56b6c2 | — |
| constant | #F78C6C | — |
| punctuation.definition.constant | #F78C6C | — |
| constant.character.escape | #57B6C2 | — |
| support.constant.meta.property-value | #29c6ff | — |
| support.variable.dom | #FFF900 | — |
| support.type.vendored.property-name, support.constant.vendored.property-value, support.type.property-name, meta.property-list entity.name.tag | #54d4ff | — |
| support.function | #29c6ff | — |
| support.variable.property | #29c6ff | — |
| support.function, entity.name.function | #ffffff | |
| support.type.property-name | #ffffff | — |
| support.constant.property-value | #abb2bf | — |
| support.constant.font-name | #F78C6C | — |
| support.constant.ext.php,support.constant.std.php,support.constant.core.php,support.constant.parser-token.php | #F78C6C | — |
| variable.instance, variable.other.instance, variable.readwrite.instance, variable.other.readwrite.instance | #f90086 | — |
| variable.other.property, variable.other.object.property | #29c6ff | — |
| variable.function | #54d4ff | — |
| variable.interpolation | #ec5f67 | — |
| variable.language | #f90086 | — |
| markup.inserted.diff | #98c379 | — |
| markup.deleted.diff | #FB467B | — |
| invalid.broken | #020e14 | — |
| invalid.unimplemented | #ffffff | — |
| invalid.illegal | #ffffff | — |
| invalid.deprecated | #ffffff | — |
| invalid.unimplemented | #ffffff | — |
| invalid.illegal | #ffffff | — |
| invalid.broken | #ffffff | — |
| keyword.operator.error-control.php | #CB6CFE | — |
| invalid | #ffffff | — |
| invalid.deprecated | #ffffff | — |
| constant.language.null | #f90086 | — |
| string.template punctuation.definition.string | #66ff00 | — |
| markup.list.numbered, markup.list.numbered.markdown | #aadcf8 | — |
| beginning.punctuation.definition.list.markdown | #FB467B | — |
| markup.quote.markdown | #a3a3a3 | italic |
| markup.inline.raw.markdown | #54d4ff | — |
| punctuation.definition.string.markdown, punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown, meta.link.inline.markdown punctuation.definition.string | #54d4ff | — |
| punctuation.definition.metadata.markdown | #f90086 | — |
| punctuation.definition.heading.markdown | #FB467B | — |
| markup.heading.setext | #ABB2BF | — |
| punctuation.definition.string.begin.markdown,punctuation.definition.string.end.markdown,punctuation.definition.metadata.markdown | #ABB2BF | — |
| punctuation.definition.metadata.markdown, markup.underline.link.image.markdown | #CB6CFE | — |
| markup.underline.link.markdown, markup.underline.link.image.markdown | #f90086 | — |
| string.other.link.title.markdown, string.other.link.description.markdown | #ffffff | — |
| markup.bold, punctuation.definition.bold, punctuation.definition.bold.markdown, bold, markup.bold.markdown | #F78C6C | bold |
| italic, markup.italic, punctuation.definition.italic, markup.italic.markdown, emphasis md | #f90086 | italic |
| markup.italic.markdown | — | italic |
| markup.heading | #FB467B | bold |
| markup.heading.markdown | #e7bfdf | — |
| entity.name.section.markdown | #FB467B | — |
| markup.heading punctuation.definition.heading, entity.name.section | #61afef | — |
| variable.assignment.coffee | #29c6ff | — |
| variable.parameter.function.coffee | #ffffff | — |
| variable.assignment.coffee | #29c6ff | — |
| entity.name.variable.local.cs | #FB467B | — |
| variable.other.readwrite.cs | #ffffff | — |
| entity.name.type.class.cs, storage.type.cs | #87E1FF | — |
| entity.name.type.namespace.cs | #e4b5b5 | — |
| meta.function.c | #FB467B | — |
| keyword.control.cpp | #f8ec42 | — |
| punctuation.section.block.begin.bracket.curly.cpp,punctuation.section.block.end.bracket.curly.cpp,punctuation.terminator.statement.c,punctuation.section.block.begin.bracket.curly.c,punctuation.section.block.end.bracket.curly.c,punctuation.section.parens.begin.bracket.round.c,punctuation.section.parens.end.bracket.round.c,punctuation.section.parameters.begin.bracket.round.c,punctuation.section.parameters.end.bracket.round.c | #abb2bf | — |
| keyword.operator.assignment.c,keyword.operator.comparison.c,keyword.operator.c,keyword.operator.increment.c | #cb6CFE | — |
| punctuation.separator.delimiter.c | #97a7c8 | — |
| support.type.posix-reserved.c | #57adb8 | — |
| keyword.operator.sizeof.c | #CB6CFE | — |
| entity.name.tag.wildcard.css, entity.name.tag.wildcard.less, entity.name.tag.wildcard.scss, entity.name.tag.wildcard.sass | #f90086 | — |
| meta.property-list entity.name.tag.reference | #f90086 | — |
| source.elixir support.type.elixir, source.elixir meta.module.elixir entity.name.class.elixir | #54d4ff | — |
| source.elixir entity.name.function | #FFF900 | — |
| source.elixir constant.other.symbol.elixir, source.elixir constant.other.keywords.elixir | #54d4ff | — |
| source.elixir punctuation.definition.string | #54d4ff | — |
| source.elixir variable.other.readwrite.module.elixir, source.elixir variable.other.readwrite.module.elixir punctuation.definition.variable.elixir | #FFF900 | — |
| source.elixir .punctuation.binary.elixir | #f90086 | — |
| source.go meta.function-call.go | #ffffff | — |
| meta.tag.sgml.doctype.html | #f90086 | — |
| entity.name.tag.doctype, meta.tag.sgml.doctype | #f90086 | — |
| entity.name.type.instance.jsdoc, entity.name.type.instance.phpdoc | #ffffff | — |
| variable.other.jsdoc, variable.other.phpdoc | #78ccf0 | — |
| keyword.operator.heredoc.php,keyword.operator.nowdoc.php | #CB6CFE | — |
| variable.other.ruby | #ffffff | — |
| constant.language.symbol.hashkey.ruby | #020405 | — |
| function.parameter.ruby, function.parameter.cs | #abb2bf | — |
| meta.attribute-selector.less entity.other.attribute-name.attribute | #ff9c31 | — |
| entity.name.tag.less | #f90086 | — |
| keyword.other.unit.css | #fff900 | — |
| constant.language.python | #f90086 | — |
| entity.name.function.decorator.python | #FFF900 | — |
| variable.parameter.function.python, meta.function-call.arguments.python | #B60DFC | — |
| meta.function-call.python, meta.function-call.generic.python | #cccccc | — |
| source.python variable.language.special | #54d4ff | — |
| variable.parameter.function.language.python | #F78C6C | — |
| support.type.python | #56b6c2 | — |
| keyword.operator.logical.python | #CB6CFE | — |
| punctuation.definition.arguments.begin.python,punctuation.definition.arguments.end.python,punctuation.separator.arguments.python,punctuation.definition.list.begin.python,punctuation.definition.list.end.python,meta.function-call.arguments.python | #abb2bf | — |
| meta.function-call.generic.python | #61afef | — |
| meta.function.decorator.python | #61afef | — |
| support.token.decorator.python,meta.function.decorator.identifier.python | #56B6C2 | — |
| punctuation.python | #ffffff | — |
| variable.parameter.function.python | #D18C4E | — |
| meta.function-call.arguments.python | #E06C60 | — |
| meta.function-call.python | #E06C60 | — |
| keyword.operator.type.php | #CB6CFE | — |
| invalid.illegal.non-null-typehinted.php | #ff0000 | — |
| storage.type.php | #f8ec42 | — |
| meta.function-call.php,meta.function-call.object.php,meta.function-call.static.php | #61afef | — |
| entity.name.goto-label.php,support.other.php | #61afef | — |
| keyword.operator.logical.php,keyword.operator.bitwise.php,keyword.operator.arithmetic.php | #56b6c2 | — |
| keyword.operator.regexp.php | #CB6CFE | — |
| keyword.operator.comparison.php | #56b6c2 | — |
| punctuation.definition.variable.php | #FB467B | — |
| variable.other.php | #ffffff | — |
| support.class.php | #ff9c31 | — |
| variable.other.global.php | #FFF900 | — |
| variable.other.global.php punctuation.definition.variable | #FFF900 | — |
| meta.function-call.php punctuation | #ffffff | — |
| constant.numeric.css, constant.character.numeric.css | #F78C6C | — |
| keyword.other.unit.css | #fff900 | — |
| punctuation.separator.list.comma.css | #e23963b6 | — |
| punctuation.separator.key-value.css | #fa6bff | — |
| meta.attribute-selector.css entity.other.attribute-name.attribute | #ff9c31 | — |
| constant.other.color | #F78C6C | — |
| support.type.property-name.css | #ffffff | — |
| entity.other.attribute-name | #fff900 | — |
| support.constant.property-value.scss,support.constant.property-value.css | #6cb0fd | — |
| variable.scss, variable.sass, variable.parameter.url.scss, variable.parameter.url.sass | #ffffff | — |
| source.css.scss meta.at-rule variable, source.css.sass meta.at-rule variable | #54d4ff | — |
| source.css.scss meta.at-rule variable, source.css.sass meta.at-rule variable | #ffffff | — |
| keyword.other.unit.scss, keyword.other.unit.sass | #fff900 | — |
| entity.name.tag.scss, entity.name.tag.sass | #f90086 | — |
| selector.sass | #FB467B | — |
| entity.name.tag.yaml | #29c6ff | — |
| support.type.primitive.ts,support.type.builtin.ts | #f8ec42 | — |
| variable.other.readwrite.ts, variable.other.readwrite.tsx, variable.other.object.ts, variable.other.object.tsx, variable.object.property.ts, variable.object.property.tsx, variable.other.ts, variable.other.tsx, variable.tsx, variable.ts | #ffffff | — |
| entity.name.type.ts, entity.name.type.tsx | #78ccf0 | — |
| variable.other.readwrite.alias.ts, variable.other.readwrite.alias.tsx | #ffffff | — |
| support.class.node.ts, support.class.node.tsx | #54d4ff | — |
| meta.type.parameters.ts entity.name.type, meta.type.parameters.tsx entity.name.type | #ffffff | — |
| meta.import.ts punctuation.definition.block, meta.import.tsx punctuation.definition.block, meta.export.ts punctuation.definition.block, meta.export.tsx punctuation.definition.block | #ffffff | — |
| meta.decorator punctuation.decorator.ts, meta.decorator punctuation.decorator.tsx | #54d4ff | — |
| meta.jsx.children.tsx, meta.tag.js meta.jsx.children.tsx | #54d4ff | — |
| storage.type.js | #ff0088 | — |
| storage.modifier.js | #ff0088 | — |
| storage.modifier.import.js, import.storage.js, meta.import.js, source.js | #FB467B | — |
| meta.definition.variable.name.js | #FB467B | — |
| token.variable.parameter.js | #abb2bf | — |
| variable.other.object.js | #afc3e7 | |
| punctuation.accessor.js | #FB467B | — |
| keyword.operator.new.js | #ff0088 | — |
| meta.method.js, keyword.other.special-method.js, meta.function-call.generic.js, meta.function-call.js, function.parameter.js, token.variable.parameter.js, variable.parameter.js, variable.parameter.function.js | #ffffff | — |
| meta.return-type.java | #ff0088 | — |
| keyword.operator.logical.js,keyword.operator.logical.ts | #FB467B | — |
| keyword.operator.bitwise.js,keyword.operator.bitwise.ts | #FB467B | — |
| punctuation.separator.key-value.js,punctuation.separator.key-value.ts | #97a7c8 | — |
| entity.other.attribute-name.js,variable.parameter.js,variable.language.super.js,entity.other.attribute-name.ts,variable.parameter.ts,variable.language.super.ts, | — | italic |
| entity.name.function.js,support.function.console.js,entity.name.function.ts,support.function.console.ts | #658efd | — |
| support.type.object.console.js,support.type.object.console.ts | #FB467B | — |
| keyword.operator.js,keyword.operator.ts | #56b6c2 | — |
| keyword.operator.expression.instanceof.js,keyword.operator.expression.instanceof.ts,keyword.operator.new.js,keyword.operator.new.ts,keyword.operator.ternary.js,keyword.operator.ternary.ts | #CB6CFE | — |
| support.module.node.js,support.type.object.module.js,support.module.node.js,support.module.node.ts,support.type.object.module.ts,support.module.node.ts | #f8ec42 | — |
| support.type.object.dom.js,support.type.object.dom.ts | #56b6c2 | — |
| support.variable.dom.js,support.variable.property.dom.js,support.variable.dom.ts,support.variable.property.dom.ts, | #FB467B | — |
| var.this.js,var.this.ts,variable.language.this.js,variable.language.this.ts | #f8ec42 | italic |
| keyword.operator.expression.typeof.js,keyword.operator.expression.typeof.ts | #61afef | — |
| token.storage.js, token.storage.ts | #CB6CFE | — |
| punctuation.definition.template-expression.begin.js,punctuation.definition.template-expression.end.js,punctuation.definition.template-expression.begin.ts,punctuation.definition.template-expression.end.ts | #FB467B | — |
| storage.type.ts | #ff0088 | — |
| storage.modifier.ts | #ff0088 | — |
| storage.modifier.import.ts, import.storage.ts, meta.import.ts, source.ts | #FB467B | — |
| meta.definition.variable.name.ts | #FB467B | — |
| token.variable.parameter.ts | #abb2bf | — |
| variable.other.object.ts | #afc3e7 | italic bold |
| punctuation.accessor.ts | #FB467B | — |
| keyword.operator.new.ts | #ff0088 | — |
| meta.method.ts, keyword.other.special-method.ts, meta.function-call.generic.ts, meta.function-call.ts, function.parameter.ts, token.variable.parameter.ts, variable.parameter.ts, variable.parameter.function.ts | #ffffff | — |
| meta.return-type.java | #ff0088 | — |
| support.type.property-name.json | #52b1fff3 | — |
| support.constant.json | #52b1fff3 | — |
| meta.structure.dictionary.value.json string.quoted.double | #30ffe3 | — |
| string.quoted.double.json punctuation.definition.string.json | #66ff00 | — |
| meta.structure.dictionary.json meta.structure.dictionary.value constant.language | #f90086 | — |
| less rgb-value | #F78C6C | — |
| rgb-value | #56B6C2 | — |
| inline-color-decoration rgb-value | #F78C6C | — |
| variable.other.property.java, variable.other.object.property.java | #29c6ff | — |
| comment, comment storage.type, comment variable, comment support.variable, comment support.class, comment support.type, comment entity.name.type, comment entity.name.class, comment keyword.operator, comment: comment, comment.line.double-slash, comment entity.name.class, comment entity.name.type, comment keyword.operator, comment storage.type, comment support.class, comment support.type, comment support.variable, comment variable, Double-Slashed Comment | #2d4e5c | bold |
| token.storage.type.java, storage.type.java, storage.type.annotation.java, storage.type.java, meta.var.expr storage.type.java, meta.class meta.method.declaration.java, meta.var.expr.java, storage.type.java | #f3e84e | — |
| storage.type.annotation.java | #0fc9fc | — |
| storage.modifier.java | #ff0088 | — |
| storage.modifier.import.java, import.storage.java, meta.import.java, source.java | #FB467B | — |
| meta.definition.variable.name.java | #FB467B | — |
| token.variable.parameter.java | #abb2bf | — |
| variable.other.object.java | #e0e4eb | |
| keyword.operator.new.java | #ff0088 | — |
| punctuation.accessor.java | #FB467B | — |
| punctuation.separator.key-value.java | #fa6bff | — |
| entity.name.function.java, support.function.console.java | #658efd | — |
| meta.method.java, keyword.other.special-method.java, meta.function-call.generic.java, meta.function-call.java, function.parameter.java, token.variable.parameter.java, variable.parameter.java, variable.parameter.function.java | #ffffff | — |
| meta.return-type.java | #ff0088 | — |
| keyword.operator.logical.java | #29c6ff | — |
| keyword.operator.bitwise.java | #29c6ff | — |
| token.package.keyword | #CB6CFE | — |
| token.package | #abb2bf | — |
| entity.name.tag, meta.tag | #ff3086 | — |
| string.quoted | #30ffe3 | — |
| entity.other.attribute-name.id.html | #FFF900 | — |
| punctuation.definition.tag.html | #29c6ff | — |
| punctuation.accessor.html | #FB467B | — |
| Token Info Token | #6796e6 | — |
| Token Warn Token | #cd9731 | — |
| Token Error Token | #f44747 | — |
| Token Debug Token | #b267e6 | — |
| token.storage.type.swift, storage.type.swift, storage.type.annotation.swift, storage.type.annotation.swift, storage.type.swift, meta.var.expr storage.type.swift, meta.class meta.method.declaration.swift, meta.var.expr.swift, storage.type.swift | #f3e84e | — |
| storage.modifier.swift | #ff0088 | — |
| storage.modifier.import.swift, import.storage.swift, meta.import.swift, source.swift | #afc3e7 | — |
| meta.definition.variable.name.swift | #FB467B | — |
| token.variable.parameter.swift | #abb2bf | — |
| variable.other.object.swift | #afc3e7 | italic bold |
| keyword.operator.new.swift | #ff0088 | — |
| punctuation.accessor.swift | #FB467B | — |
| punctuation.separator.key-value.swift | #fa6bff | — |
| entity.name.function.swift, support.function.console.swift | #658efd | — |
| meta.class.swift, variable.other.object.swift, meta.method.swift, keyword.other.special-method.swift, function.parameter.swift, token.variable.parameter.swift, variable.parameter.swift, variable.parameter.function.swift | #00abe4 | — |
TypeScript sample highlighted with this variant's colors and tokenColors.
Loading...
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}!`;
}