2121# and their associated preview
2222
2323import os
24+
2425import yaml
2526
2627
@@ -42,38 +43,38 @@ def get_themes(display_size: str):
4243 return sorted (themes , key = str .casefold )
4344
4445
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+
4560if __name__ == "__main__" :
61+ themes21inch = get_themes ('2.1"' )
4662 themes3inch = get_themes ('3.5"' )
4763 themes5inch = get_themes ('5"' )
64+ themes88inch = get_themes ('8.8"' )
4865
4966 with open ("res/themes/themes.md" , "w" , encoding = 'utf-8' ) as file :
5067 file .write ("<!--- This file is generated automatically by GitHub Actions, do not edit it! --->\n " )
5168 file .write ("\n " )
5269 file .write ("# Turing Smart Screen themes\n " )
5370 file .write ("\n " )
5471 file .write ("ℹ️ Click on a preview to view full size\n \n " )
72+ file .write ("[2.1\" themes](#21-themes)\n \n " )
5573 file .write ("[3.5\" themes](#35-themes)\n \n " )
5674 file .write ("[5\" themes](#5-themes)\n " )
75+ file .write ("[8.8\" themes](#88-themes)\n " )
5776
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