Files
Aislo/resources/tester/cad/theme-auto-color.test.ts
T
eomsangdonandClaude Opus 5.5 44a6ec51db fix(B07 CAD): 어두운 테마에서 검정 선이 안 보이던 것 — 자동색(흰/검정)
검정 · 흰색(DXF 색 7) · 기본색(#f5f7fa = 새 개체 · DXF ByLayer)은 오토캐드처럼 자동색으로 보아
어두운 바탕에서는 흰색 · 밝은 바탕에서는 검정으로 그림(그릴 때만 · 저장 값은 그대로).
다른 색은 그대로 · 어두운 바탕에서 어두운 색을 밝히지 않음 · 밝은 바탕의 밝은 색 대비 보정은 기존대로.
좌표 입력 칸 바탕도 자동색(검정)으로 바꿔 두 테마에서 글이 읽힘.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7JS47SacjPxZ718QsZKyr
2026-09-28 16:14:22 +09:00

41 lines
1.9 KiB
TypeScript

/**
* CAD 자동색(`theme.ts` paintColor) 검증 — 검정 · 흰색 · 기본색은 바탕 따라 흰/검정, 다른 색은 그대로.
* 실행: node --experimental-strip-types resources/tester/cad/theme-auto-color.test.ts
*/
import assert from 'node:assert/strict';
let theme = 'dark';
// biome-ignore lint: 시험 — 브라우저 전역 흉내
const g = globalThis as any;
g.document = { documentElement: { getAttribute: () => theme } };
g.window = { matchMedia: () => ({ matches: true }) };
const { paintColor, isAutoColor } = await import(
'../../../B07_DesignDetail/openwebcad/src/theme.ts'
);
for (const color of ['#000000', '#000', '#FFFFFF', '#fff', '#f5f7fa', 'black']) {
assert.ok(isAutoColor(color), `${color} 자동색`);
}
for (const color of ['#ff0000', '#111111', '#333333', '#1a237e', '#a55200']) {
assert.ok(!isAutoColor(color), `${color} 자동색 아님`);
}
theme = 'dark';
assert.equal(paintColor('#000000'), '#ffffff', '어두운 바탕: 검정은 흰색');
assert.equal(paintColor('#f5f7fa'), '#ffffff', '어두운 바탕: 기본색은 흰색');
assert.equal(paintColor('#ffffff'), '#ffffff');
assert.equal(paintColor('#ff0000'), '#ff0000', '어두운 바탕: 빨강 그대로');
assert.equal(paintColor('#1a237e'), '#1a237e', '어두운 바탕: 남색 밝히지 않음');
assert.equal(paintColor('#333333'), '#333333', '어두운 바탕: 어두운 회색 밝히지 않음');
theme = 'light';
assert.equal(paintColor('#ffffff'), '#000000', '밝은 바탕: 흰색은 검정');
assert.equal(paintColor('#FFF'), '#000000');
assert.equal(paintColor('#000000'), '#000000');
assert.equal(paintColor('#f5f7fa'), '#000000', '밝은 바탕: 기본색은 검정');
assert.equal(paintColor('#ff0000'), '#ff0000', '밝은 바탕: 빨강 그대로');
assert.notEqual(paintColor('#ffff00'), '#ffff00', '밝은 바탕: 노랑 등 밝은 색은 대비 보정(기존)');
console.log('theme 자동색 시험 통과');