This commit is contained in:
2026-02-05 23:23:30 +08:00
parent 66bbe0d7da
commit 141c04ba7f
2 changed files with 33 additions and 51 deletions

View File

@@ -1,8 +1,8 @@
// Reference:
// - https://docs.deno.com/runtime/fundamentals/testing/
import {decodeBase64, encodeBase64} from "jsr:@std/encoding/base64";
import {dirname, fromFileUrl} from "https://deno.land/std/path/mod.ts";
import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
import { dirname, fromFileUrl } from "https://deno.land/std/path/mod.ts";
// reference: https://docs.deno.com/examples/hex_base64_encoding/
// import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
@@ -337,6 +337,11 @@ function renderColorTokens(tokens: ColorToken[]): string {
if (token.type === "color") {
const color = token.color;
if (color) {
const colorCode = COLOR_MAP[color];
if (!colorCode) {
text.push(`[${token.colorStart ? "" : "/"}${color}]`);
continue;
}
const colorStack = colorMapStack.get(color) ?? [];
if (colorStack.length == 0) {
colorMapStack.set(color, colorStack);
@@ -350,10 +355,7 @@ function renderColorTokens(tokens: ColorToken[]): string {
const colors: string[] = [];
for (const [color, colorStack] of colorMapStack) {
if (colorStack.length > 0) {
const colorCode = COLOR_MAP[color];
if (colorCode) {
colors.push(colorCode);
}
colors.push(colorCode);
}
}
if (colors.length > 0) {