fix(ai): tag close icon inherits tone fg color

This commit is contained in:
Fini 2026-04-27 09:00:00 +08:00
parent a2bf13bfce
commit de73c09202
2 changed files with 8 additions and 1 deletions

View file

@ -58,6 +58,7 @@ export function buildTag(params: TagParams): ElementTree {
iconFontFamily: 'lucide',
width: 14,
height: 14,
fill: [{ type: 'solid', color: tone.fg }],
});
}
return {

View file

@ -107,8 +107,14 @@ describe('add_tag_v0 — structure', () => {
await handleAddTagV0({ filePath: fp, label: tone, tone });
const tag = getRoot(await readDoc(fp));
expect((tag.fill as Array<{ color: string }>)[0].color).toBe(bg);
const label = (tag.children as Record<string, unknown>[])[0];
const kids = tag.children as Record<string, unknown>[];
const label = kids[0];
expect((label.fill as Array<{ color: string }>)[0].color).toBe(fg);
// close icon must inherit the tone fg or it stays default-black
// and clashes with the label color (Codex caught this).
const remove = kids[1];
expect(remove.role).toBe('tag-remove');
expect((remove.fill as Array<{ color: string }>)[0].color).toBe(fg);
invalidateCache(fp);
await writeFile(fp, EMPTY_DOC, 'utf-8');
}