diff --git a/themes/README.md b/themes/README.md index 7ffa4c8..17468bd 100644 --- a/themes/README.md +++ b/themes/README.md @@ -30,74 +30,74 @@ Replace the SVG data URI (`url("data:image/svg+xml,...")`) with your desired SVG ## Previews of included themes -### Alpenglow Theme +### alpenglow -![Alpenglow Theme](screenshots/alpenglow.png) +![alpenglow](screenshots/alpenglow.png) | -### Aritim Dark Theme +### aritim-dark -![Aritim Dark Theme](screenshots/aritim-dark.png) +![aritim-dark](screenshots/aritim-dark.png) | -### Aritim Theme +### aritim -![Aritim Theme](screenshots/aritim.png) +![aritim](screenshots/aritim.png) | -### Autumn Theme +### autumn -![Autumn Theme](screenshots/autumn.png) +![autumn](screenshots/autumn.png) | -### Carnation Theme +### carnation -![Carnation Theme](screenshots/carnation.png) +![carnation](screenshots/carnation.png) | -### Catpuccino Theme +### catpuccin -![Catpuccin Theme](screenshots/catpuccin.png) +![catpuccin](screenshots/catpuccin.png) | -### Cornflower Theme +### cornflower -![Cornflower Theme](screenshots/cornflower.png) +![cornflower](screenshots/cornflower.png) | -### Default Dark Theme +### default-dark -![Default Dark Theme](screenshots/default-dark.png) +![default-dark](screenshots/default-dark.png) | -### Default Theme +### default -![Default Theme](screenshots/default.png) +![default](screenshots/default.png) | -### Ivy Theme +### ivy -![Ivy Theme](screenshots/ivy.png) +![ivy](screenshots/ivy.png) | -### Kjoe Theme +### kjoe -![Kjoe Theme](screenshots/kjoe.png) +![kjoe](screenshots/kjoe.png) | -### Monokai Vibrant Theme +### monokai-vibrant -![Monokai Vibrant Theme](screenshots/monokai-vibrant.png) +![monokai-vibrant](screenshots/monokai-vibrant.png) | -### Rainbow Theme +### rainbow -![Rainbow Theme](screenshots/rainbow.png) +![rainbow](screenshots/rainbow.png) | -### Spring Theme +### spring -![Spring Theme](screenshots/spring.png) +![spring](screenshots/spring.png) | -### Steam Theme +### steam -![Steam Theme](screenshots/steam.png) +![steam](screenshots/steam.png) | -### Summer Theme +### summer -![Summer Theme](screenshots/summer.png) +![summer](screenshots/summer.png) | -### Sunflower Theme +### sunflower -![Sunflower Theme](screenshots/sunflower.png) +![sunflower](screenshots/sunflower.png) | -### Winter Theme +### winter -![Winter Theme](screenshots/winter.png) +![winter](screenshots/winter.png) | diff --git a/themes/generate_preview.py b/themes/generate_preview.py index 86d128a..ab86cf7 100644 --- a/themes/generate_preview.py +++ b/themes/generate_preview.py @@ -44,6 +44,16 @@ def take_screenshot(html_file, css_file, output_file): driver.quit() +def write_readme(_folder_path: str, themes: list[str]): + with open(os.path.join(_folder_path, "README.md"), "r", encoding="utf-8") as f: + readme = f.read() + readmehead = readme.split("## Previews of included themes")[0] + readmehead += f"""## Previews of included themes +{ "".join([f'\n### {theme}\n\n![{theme}](screenshots/{theme}.png) |\n' for theme in themes]) }""" + with open(os.path.join(_folder_path, "README.md"), "w", encoding="utf-8") as f: + f.write(readmehead) + + def main(_folder_path): html_file = "/mnt/nfs/pictures/Analog/Example/index.html" @@ -52,15 +62,20 @@ def main(_folder_path): print(f'Error: Folder path "{_folder_path}" does not exist.') return + themes = [] # Iterate over all files in the folder for filename in sorted(os.listdir(_folder_path)): if filename.endswith(".css"): + themes.append(os.path.splitext(filename)[0]) css_file = os.path.join(_folder_path, filename) output_file = os.path.join(_folder_path, "screenshots", f"{os.path.splitext(filename)[0]}.png") # Take screenshot for this CSS file take_screenshot(html_file, css_file, output_file) + # Write the README file with the new previews + write_readme(_folder_path, themes) + if __name__ == "__main__": if len(sys.argv) != 2: