code.gitea.io/gitea@v1.21.7/web_src/js/utils/color.test.js (about)

     1  import {useLightTextOnBackground} from './color.js';
     2  
     3  test('useLightTextOnBackground', () => {
     4    expect(useLightTextOnBackground(215, 58, 74)).toBe(true);
     5    expect(useLightTextOnBackground(0, 117, 202)).toBe(true);
     6    expect(useLightTextOnBackground(207, 211, 215)).toBe(false);
     7    expect(useLightTextOnBackground(162, 238, 239)).toBe(false);
     8    expect(useLightTextOnBackground(112, 87, 255)).toBe(true);
     9    expect(useLightTextOnBackground(0, 134, 114)).toBe(true);
    10    expect(useLightTextOnBackground(228, 230, 105)).toBe(false);
    11    expect(useLightTextOnBackground(216, 118, 227)).toBe(true);
    12    expect(useLightTextOnBackground(255, 255, 255)).toBe(false);
    13    expect(useLightTextOnBackground(43, 134, 133)).toBe(true);
    14    expect(useLightTextOnBackground(43, 135, 134)).toBe(true);
    15    expect(useLightTextOnBackground(44, 135, 134)).toBe(true);
    16    expect(useLightTextOnBackground(59, 182, 179)).toBe(true);
    17    expect(useLightTextOnBackground(124, 114, 104)).toBe(true);
    18    expect(useLightTextOnBackground(126, 113, 108)).toBe(true);
    19    expect(useLightTextOnBackground(129, 112, 109)).toBe(true);
    20    expect(useLightTextOnBackground(128, 112, 112)).toBe(true);
    21  });