fix: tag coloring code duplications cleand up

This commit is contained in:
2026-02-15 22:21:40 +01:00
parent daff6603a4
commit e13cb209be
7 changed files with 44 additions and 76 deletions

View File

@@ -0,0 +1,19 @@
import { describe, it, expect } from 'vitest';
import { getContrastColor } from '../../../src/renderer/utils/color';
describe('getContrastColor', () => {
it('should return black text for light 6-char colors', () => {
expect(getContrastColor('#ffffff')).toBe('#000000');
expect(getContrastColor('fef3c7')).toBe('#000000');
});
it('should return white text for dark 6-char colors', () => {
expect(getContrastColor('#000000')).toBe('#ffffff');
expect(getContrastColor('1f2937')).toBe('#ffffff');
});
it('should support 3-char hex colors', () => {
expect(getContrastColor('#abc')).toBe('#000000');
expect(getContrastColor('333')).toBe('#ffffff');
});
});