• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gitify-app / gitify / 12917447197

22 Jan 2025 09:31PM UTC coverage: 86.565% (-0.5%) from 87.021%
12917447197

Pull #1752

github

web-flow
Merge 0ee7bd591 into 3cd267a15
Pull Request #1752: feat: primer color schemes

604 of 689 branches covered (87.66%)

Branch coverage included in aggregate %.

44 of 58 new or added lines in 6 files covered. (75.86%)

1677 of 1946 relevant lines covered (86.18%)

22.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.19
/src/renderer/utils/theme.ts
1
import type { ColorModeWithAuto } from '@primer/react/lib/ThemeProvider';
2
import { ThemeMode } from '../types';
60✔
3

4
export const DEFAULT_DAY_COLOR_SCHEME = 'light';
60✔
5
export const DEFAULT_NIGHT_COLOR_SCHEME = 'dark';
60✔
6

7
/**
8
 * @deprecated
9
 */
10
export function getTheme(): ThemeMode {
60✔
11
  if (document.querySelector('html').classList.contains('dark')) {
8✔
12
    return ThemeMode.DARK_DEFAULT;
4✔
13
  }
14

15
  return ThemeMode.LIGHT_DEFAULT;
4✔
16
}
17

18
/**
19
 * @deprecated
20
 */
21
export function setLightMode() {
60✔
22
  document.querySelector('html').classList.remove('dark');
4✔
23
}
24

25
/**
26
 * @deprecated
27
 */
28
export function setDarkMode() {
60✔
29
  document.querySelector('html').classList.add('dark');
24✔
30
}
31

32
/**
33
 * @deprecated
34
 */
35
export function setScrollbarTheme(mode?: ColorModeWithAuto) {
60✔
36
  switch (mode) {
28✔
37
    case 'day':
38
    case 'light':
39
      setLightMode();
2✔
40
      break;
2✔
41
    case 'night':
42
    case 'dark':
43
      setDarkMode();
22✔
44
      break;
22✔
45
    default:
46
      if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) {
4✔
47
        setDarkMode();
2✔
48
      } else {
49
        setLightMode();
2✔
50
      }
51
  }
52
}
53

54
export function isDayScheme(themeMode: ThemeMode) {
60✔
55
  switch (themeMode) {
20!
56
    case ThemeMode.LIGHT_DEFAULT:
57
    case ThemeMode.LIGHT_HIGH_CONTRAST:
58
    case ThemeMode.LIGHT_COLOR_BLIND:
59
    case ThemeMode.LIGHT_TRITANOPIA:
NEW
60
      return true;
×
61
    default:
62
      return false;
20✔
63
  }
64
}
65

66
export function mapThemeModeToColorScheme(themeMode: ThemeMode): string | null {
60✔
67
  switch (themeMode) {
40✔
68
    case ThemeMode.LIGHT_DEFAULT:
69
      return 'light';
2✔
70
    case ThemeMode.LIGHT_HIGH_CONTRAST:
71
      return 'light_high_contrast';
2✔
72
    case ThemeMode.LIGHT_COLOR_BLIND:
73
      return 'light_colorblind';
2✔
74
    case ThemeMode.LIGHT_TRITANOPIA:
75
      return 'light_tritanopia';
2✔
76
    case ThemeMode.DARK_DEFAULT:
77
      return 'dark';
2✔
78
    case ThemeMode.DARK_HIGH_CONTRAST:
79
      return 'dark_high_contrast';
2✔
80
    case ThemeMode.DARK_COLOR_BLIND:
81
      return 'dark_colorblind';
2✔
82
    case ThemeMode.DARK_TRITANOPIA:
83
      return 'dark_tritanopia';
2✔
84
    case ThemeMode.DARK_DIMMED:
85
      return 'dark_dimmed';
2✔
86
    default:
87
      return null;
22✔
88
  }
89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc