1- using System . Drawing ;
1+ using System . Collections . Generic ;
2+ using System . Drawing ;
3+ using System . Linq ;
24using System . Windows . Forms ;
35
46namespace Orts . Viewer3D . Debugging
57{
68 public class MapThemeProvider
79 {
8- public ThemeStyle LightTheme ;
9- public ThemeStyle DarkTheme ;
10-
1110 public void InitializeThemes ( )
1211 {
13- LightTheme = new ThemeStyle
12+ ThemeStyle LightTheme = new ThemeStyle
1413 {
1514 BackColor = Color . Transparent ,
1615 ForeColor = SystemColors . ControlText ,
@@ -20,7 +19,7 @@ public void InitializeThemes()
2019 TrackColor = Color . FromArgb ( 46 , 64 , 83 ) ,
2120 } ;
2221
23- DarkTheme = new ThemeStyle
22+ ThemeStyle DarkTheme = new ThemeStyle
2423 {
2524 BackColor = Color . FromArgb ( 44 , 62 , 80 ) ,
2625 ForeColor = Color . FromArgb ( 247 , 249 , 249 ) ,
@@ -29,6 +28,50 @@ public void InitializeThemes()
2928 MapCanvasColor = Color . FromArgb ( 44 , 62 , 80 ) ,
3029 TrackColor = Color . FromArgb ( 234 , 236 , 238 ) ,
3130 } ;
31+
32+ // Reference for "solarized" themes: https://github.com/altercation/solarized?tab=readme-ov-file#the-values
33+ ThemeStyle LightSolarizedTheme = new ThemeStyle
34+ {
35+ BackColor = Color . FromArgb ( 253 , 246 , 227 ) ,
36+ ForeColor = Color . FromArgb ( 101 , 123 , 131 ) ,
37+ PanelBackColor = Color . FromArgb ( 238 , 232 , 213 ) ,
38+ FlatStyle = FlatStyle . Flat ,
39+ MapCanvasColor = Color . FromArgb ( 253 , 246 , 227 ) ,
40+ TrackColor = Color . FromArgb ( 88 , 110 , 117 ) ,
41+ } ;
42+
43+ ThemeStyle DarkSolarizedTheme = new ThemeStyle
44+ {
45+ BackColor = Color . FromArgb ( 0 , 43 , 54 ) ,
46+ ForeColor = Color . FromArgb ( 131 , 148 , 150 ) ,
47+ PanelBackColor = Color . FromArgb ( 28 , 40 , 51 ) ,
48+ FlatStyle = FlatStyle . Flat ,
49+ MapCanvasColor = Color . FromArgb ( 0 , 43 , 54 ) ,
50+ TrackColor = Color . FromArgb ( 147 , 161 , 161 ) ,
51+ } ;
52+
53+ Themes . Add ( "light" , LightTheme ) ;
54+ Themes . Add ( "light-solarized" , LightSolarizedTheme ) ;
55+ Themes . Add ( "dark-solarized" , DarkSolarizedTheme ) ;
56+ Themes . Add ( "dark" , DarkTheme ) ;
57+ }
58+
59+ private Dictionary < string , ThemeStyle > Themes = new Dictionary < string , ThemeStyle > ( ) ;
60+
61+ public ThemeStyle GetTheme ( string themeName )
62+ {
63+ if ( Themes . TryGetValue ( themeName , out ThemeStyle theme ) )
64+ {
65+ return theme ;
66+ }
67+
68+ // Handle the case when the theme doesn't exist
69+ return null ;
70+ }
71+
72+ public string [ ] GetThemes ( )
73+ {
74+ return Themes . Keys . ToArray ( ) ;
3275 }
3376 }
3477
0 commit comments