token.ts

 1import { SingleColorToken, TokenTypes } from "@tokens-studio/types"
 2
 3export function color_token(
 4    name: string,
 5    value: string,
 6    description?: string
 7): SingleColorToken {
 8    const token: SingleColorToken = {
 9        name,
10        type: TokenTypes.COLOR,
11        value,
12        description,
13    }
14
15    if (!token.value || token.value === "")
16        throw new Error("Color token must have a value")
17
18    return token
19}