color
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user