MCPcopy
hub / github.com/originalankur/maptoposter / load_theme

Function load_theme

create_map_poster.py:66–95  ·  view source on GitHub ↗

Load theme from JSON file in themes directory.

(theme_name="feature_based")

Source from the content-addressed store, hash-verified

64 return themes
65
66def load_theme(theme_name="feature_based"):
67 """
68 Load theme from JSON file in themes directory.
69 """
70 theme_file = os.path.join(THEMES_DIR, f"{theme_name}.json")
71
72 if not os.path.exists(theme_file):
73 print(f"⚠ Theme file '{theme_file}' not found. Using default feature_based theme.")
74 # Fallback to embedded default theme
75 return {
76 "name": "Feature-Based Shading",
77 "bg": "#FFFFFF",
78 "text": "#000000",
79 "gradient_color": "#FFFFFF",
80 "water": "#C0C0C0",
81 "parks": "#F0F0F0",
82 "road_motorway": "#0A0A0A",
83 "road_primary": "#1A1A1A",
84 "road_secondary": "#2A2A2A",
85 "road_tertiary": "#3A3A3A",
86 "road_residential": "#4A4A4A",
87 "road_default": "#3A3A3A"
88 }
89
90 with open(theme_file, 'r') as f:
91 theme = json.load(f)
92 print(f"✓ Loaded theme: {theme.get('name', theme_name)}")
93 if 'description' in theme:
94 print(f" {theme['description']}")
95 return theme
96
97# Load theme (can be changed via command line or input)
98THEME = None # Will be loaded later

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected