21
21
# and their associated preview
22
22
23
23
import os
24
+
24
25
import yaml
25
26
26
27
@@ -42,38 +43,38 @@ def get_themes(display_size: str):
42
43
return sorted (themes , key = str .casefold )
43
44
44
45
46
+ def write_theme_previews_to_file (themes , file , size ):
47
+ file .write (f"\n ## { size } themes\n " )
48
+ file .write ("<table>" )
49
+ i = 0
50
+ for theme in themes :
51
+ file .write (
52
+ f"<td>{ theme } <img src=\" https://raw.githubusercontent.com/mathoudebine/turing-smart-screen-python/main/res/themes/{ theme } /preview.png\" width=\" 150\" /></td>" )
53
+ i = i + 1
54
+ if i >= 5 :
55
+ file .write ("</table><table>" )
56
+ i = 0
57
+ file .write ("</table>\n " )
58
+
59
+
45
60
if __name__ == "__main__" :
61
+ themes21inch = get_themes ('2.1"' )
46
62
themes3inch = get_themes ('3.5"' )
47
63
themes5inch = get_themes ('5"' )
64
+ themes88inch = get_themes ('8.8"' )
48
65
49
66
with open ("res/themes/themes.md" , "w" , encoding = 'utf-8' ) as file :
50
67
file .write ("<!--- This file is generated automatically by GitHub Actions, do not edit it! --->\n " )
51
68
file .write ("\n " )
52
69
file .write ("# Turing Smart Screen themes\n " )
53
70
file .write ("\n " )
54
71
file .write ("ℹ️ Click on a preview to view full size\n \n " )
72
+ file .write ("[2.1\" themes](#21-themes)\n \n " )
55
73
file .write ("[3.5\" themes](#35-themes)\n \n " )
56
74
file .write ("[5\" themes](#5-themes)\n " )
75
+ file .write ("[8.8\" themes](#88-themes)\n " )
57
76
58
- file .write ("\n ## 3.5\" themes\n " )
59
- file .write ("<table>" )
60
- i = 0
61
- for theme in themes3inch :
62
- file .write (f"<td>{ theme } <img src=\" https://raw.githubusercontent.com/mathoudebine/turing-smart-screen-python/main/res/themes/{ theme } /preview.png\" width=\" 150\" /></td>" )
63
- i = i + 1
64
- if i >= 5 :
65
- file .write ("</table><table>" )
66
- i = 0
67
- file .write ("</table>\n " )
68
-
69
- file .write ("\n ## 5\" themes\n " )
70
- file .write ("<table>" )
71
- i = 0
72
- for theme in themes5inch :
73
- file .write (f"<td>{ theme } <img src=\" https://raw.githubusercontent.com/mathoudebine/turing-smart-screen-python/main/res/themes/{ theme } /preview.png\" width=\" 150\" /></td>" )
74
- i = i + 1
75
- if i >= 5 :
76
- file .write ("</table><table>" )
77
- i = 0
78
- file .write ("</table>\n " )
79
-
77
+ write_theme_previews_to_file (themes21inch , file , "2.1\" " )
78
+ write_theme_previews_to_file (themes3inch , file , "3.5\" " )
79
+ write_theme_previews_to_file (themes5inch , file , "5\" " )
80
+ write_theme_previews_to_file (themes88inch , file , "8.8\" " )
0 commit comments