Coverage for src/jsoncrack_for_sphinx/config/config_values.py: 83%

12 statements  

« prev     ^ index     » next       coverage.py v7.10.0, created at 2025-07-24 22:26 +0000

1""" 

2Configuration value extraction utilities. 

3""" 

4 

5from typing import Any, Dict 

6 

7from ..utils.types import RenderMode, Theme 

8from .config_main import JsonCrackConfig 

9 

10 

11def get_config_values(config: JsonCrackConfig) -> Dict[str, Any]: 

12 """Extract configuration values for HTML generation.""" 

13 

14 # Get render mode settings 

15 render_mode = config.render.mode.mode 

16 onscreen_threshold = 0.1 

17 onscreen_margin = "50px" 

18 

19 # Only get threshold and margin for OnScreen mode 

20 if isinstance(config.render.mode, RenderMode.OnScreen): 

21 onscreen_threshold = config.render.mode.threshold 

22 onscreen_margin = config.render.mode.margin 

23 

24 # Get theme value 

25 theme_value = config.theme.value if config.theme != Theme.AUTO else None 

26 

27 return { 

28 "render_mode": render_mode, 

29 "theme": theme_value, 

30 "direction": config.container.direction.value, 

31 "height": config.container.height, 

32 "width": config.container.width, 

33 "onscreen_threshold": onscreen_threshold, 

34 "onscreen_margin": onscreen_margin, 

35 }