Best Themes Redefined π
Publisher: Lakshit SomaniThemes in package: 92
π¨π A never seen collection of 92 hand crafted themes no where to be found on Internet π»
π¨π A never seen collection of 92 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}!`;
}