fix: tag coloring code duplications cleand up
This commit is contained in:
19
tests/renderer/utils/color.test.ts
Normal file
19
tests/renderer/utils/color.test.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user