Coverage for src/prints/themes.py: 100.00%

37 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-10-18 15:02 +0000

1#!/usr/bin/env python3 

2 

3# Standard libraries 

4from typing import Dict 

5 

6# Components 

7from .colors import Colors 

8 

9# Themes class 

10class Themes: 

11 

12 # Constants 

13 POINTER: str = '»' 

14 

15 # Flags 

16 __prepared = False 

17 

18 # Members 

19 __bold: str = '' 

20 __cyan: str = '' 

21 __disabled: str = '' 

22 __green: str = '' 

23 __selected: str = '' 

24 __yellow: str = '' 

25 

26 # Prepare 

27 @staticmethod 

28 def __prepare() -> None: 

29 

30 # Colors enabled 

31 if Colors.enabled(): 

32 Themes.__bold = 'bold' 

33 Themes.__cyan = '#00FFFF bold' 

34 Themes.__disabled = 'italic' 

35 Themes.__green = '#00FF00 bold noreverse' 

36 Themes.__selected = 'bold noreverse' 

37 Themes.__yellow = '#FFFF00 bold' 

38 

39 # Colors disabled 

40 else: 

41 Themes.__bold = 'noinherit bold' 

42 Themes.__cyan = 'noinherit bold' 

43 Themes.__disabled = 'noinherit italic' 

44 Themes.__green = 'noinherit bold noreverse' 

45 Themes.__selected = 'noinherit bold noreverse' 

46 Themes.__yellow = 'noinherit bold' 

47 

48 # Raise flag 

49 Themes.__prepared = True 

50 

51 # Checkbox 

52 @staticmethod 

53 def checkbox_style() -> Dict[str, str]: 

54 

55 # Prepare 

56 if not Themes.__prepared: 

57 Themes.__prepare() 

58 

59 # Result 

60 return { 

61 'answer': Themes.__cyan, 

62 'disabled': Themes.__disabled, 

63 'instruction': Themes.__cyan, 

64 'highlighted': Themes.__bold, 

65 'pointer': Themes.__yellow, 

66 'qmark': Themes.__yellow, 

67 'question': Themes.__green, 

68 'selected': Themes.__selected, 

69 'separator': Themes.__yellow, 

70 } 

71 

72 # Configuration 

73 @staticmethod 

74 def configuration_style() -> Dict[str, str]: 

75 

76 # Prepare 

77 if not Themes.__prepared: 

78 Themes.__prepare() 

79 

80 # Result 

81 return { 

82 'answer': Themes.__cyan, 

83 'instruction': Themes.__cyan, 

84 'highlighted': Themes.__green, 

85 'pointer': Themes.__yellow, 

86 'qmark': Themes.__yellow, 

87 'question': Themes.__yellow, 

88 'selected': Themes.__selected, 

89 'separator': Themes.__yellow, 

90 }