From 1aca11db75a7a150f8e55822da0beb6bcb34d5ae Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Fri, 6 Feb 2026 23:58:52 +0800 Subject: [PATCH] v 1.0.3 --- package.json | 2 +- src/index.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0d13b57..d8641c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hatterjiang/term-color-render", - "version": "1.0.2", + "version": "1.0.3", "description": "Render color for term use syntax like [red]text[/red]", "license": "MIT", "author": "Hatter Jiang", diff --git a/src/index.ts b/src/index.ts index c3e693c..c96ac5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -115,7 +115,10 @@ function renderColorTokens(tokens: ColorToken[], renderColor: boolean): string { const colors: string[] = []; for (const [color, colorStack] of colorMapStack) { if (colorStack.length > 0) { - colors.push(colorCode); + const currentColorCode = COLOR_MAP[color]; + if (currentColorCode) { + colors.push(currentColorCode); + } } } if (colors.length > 0) {