From b59abf9f1615368bade073120af87c5e4b90665a Mon Sep 17 00:00:00 2001 From: Flo Greistorfer Date: Tue, 9 Jul 2024 15:44:09 +0200 Subject: [PATCH] added cornflower theme --- StaticGalleryBuilder.code-workspace | 8 +-- builder.py | 28 +++++----- themes/cornflower.css | 79 +++++++++++++++++++++++++++++ themes/default-dark.css | 5 ++ themes/default.css | 5 ++ themes/kjoe.css | 9 ++-- themes/monokai-vibrant.css | 5 ++ 7 files changed, 120 insertions(+), 19 deletions(-) create mode 100644 themes/cornflower.css diff --git a/StaticGalleryBuilder.code-workspace b/StaticGalleryBuilder.code-workspace index b9f8634..884a5f5 100644 --- a/StaticGalleryBuilder.code-workspace +++ b/StaticGalleryBuilder.code-workspace @@ -102,7 +102,8 @@ "themes/default.css", "--use-fancy-folders", "--web-manifest", - "-n" + "-n", + "-r" ], "postDebugTask": "Delete Lockfile" }, @@ -120,10 +121,11 @@ "-t", "Pictures", "--theme", - "themes/kjoe.css", + "themes/cornflower.css", "--use-fancy-folders", "--web-manifest", - "-n" + "-n", + "-r" ], "postDebugTask": "Delete Lockfile 2" } diff --git a/builder.py b/builder.py index 42046dc..dadb27a 100755 --- a/builder.py +++ b/builder.py @@ -31,7 +31,7 @@ FAVICON_PATH = ".static/favicon.ico" GLOBAL_CSS_PATH = ".static/global.css" DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css") DEFAULT_AUTHOR = "Author" -VERSION = "1.9.10" +VERSION = "1.9.11" RAW_EXTENSIONS = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"] IMG_EXTENSIONS = [".jpg", ".jpeg"] EXCLUDES = [".lock", "index.html", "manifest.json", ".sizelist.json", ".thumbnails", ".static"] @@ -72,21 +72,21 @@ class Args: # fmt: off def parse_arguments() -> Args: parser = argparse.ArgumentParser(description="Generate HTML files for a static image hosting website.", formatter_class=RichHelpFormatter) - parser.add_argument("-p", "--root-directory", help="Root directory containing the images.", required=True, type=str, dest="root_directory", metavar="ROOT") - parser.add_argument("-w", "--web-root-url", help="Base URL of the web root for the image hosting site.", required=True, type=str, dest="web_root_url", metavar="URL") - parser.add_argument("-t", "--site-title", help="Title of the image hosting site.", required=True, type=str, dest="site_title", metavar="TITLE") - parser.add_argument("-r", "--regenerate-thumbnails", help="Regenerate thumbnails even if they already exist.", action="store_true", default=False, dest="regenerate_thumbnails") - parser.add_argument("-n", "--non-interactive-mode", help="Run in non-interactive mode, disabling progress bars.", action="store_true", default=False, dest="non_interactive_mode") - parser.add_argument("-l", "--license-type", help="Specify the license type for the images.", choices=["cc-zero", "cc-by", "cc-by-sa", "cc-by-nd", "cc-by-nc", "cc-by-nc-sa", "cc-by-nc-nd"], default=None, dest="license_type", metavar="LICENSE") - parser.add_argument("-a", "--author-name", help="Name of the author of the images.", default=DEFAULT_AUTHOR, type=str, dest="author_name", metavar="AUTHOR") - parser.add_argument("-e", "--file-extensions", help="File extensions to include (can be specified multiple times).", action="append", dest="file_extensions", metavar="EXTENSION") - parser.add_argument("-m", "--web-manifest", help="Generate a web manifest file.", action="store_true", default=False, dest="generate_webmanifest") + parser.add_argument("--exclude-folder", help="Folders to exclude from processing, globs supported (can be specified multiple times).", action="append", dest="exclude_folders", metavar="FOLDER") + parser.add_argument("--generate-help-preview", action=HelpPreviewAction, path="help.svg") + parser.add_argument("--ignore-other-files", help="Ignore files that do not match the specified extensions.", action="store_true", default=False, dest="ignore_other_files") parser.add_argument("--theme-path", help="Path to the CSS theme file.", default=DEFAULT_THEME_PATH, type=str, dest="theme_path", metavar="PATH") parser.add_argument("--use-fancy-folders", help="Enable fancy folder view instead of the default Apache directory listing.", action="store_true", default=False, dest="use_fancy_folders") - parser.add_argument("--ignore-other-files", help="Ignore files that do not match the specified extensions.", action="store_true", default=False, dest="ignore_other_files") - parser.add_argument("--exclude-folder", help="Folders to exclude from processing, globs supported (can be specified multiple times).", action="append", dest="exclude_folders", metavar="FOLDER") parser.add_argument("--version", action="version", version=f"%(prog)s {VERSION}") - parser.add_argument("--generate-help-preview", action=HelpPreviewAction, path="help.svg") + parser.add_argument("-a", "--author-name", help="Name of the author of the images.", default=DEFAULT_AUTHOR, type=str, dest="author_name", metavar="AUTHOR") + parser.add_argument("-e", "--file-extensions", help="File extensions to include (can be specified multiple times).", action="append", dest="file_extensions", metavar="EXTENSION") + parser.add_argument("-l", "--license-type", help="Specify the license type for the images.", choices=["cc-zero", "cc-by", "cc-by-sa", "cc-by-nd", "cc-by-nc", "cc-by-nc-sa", "cc-by-nc-nd"], default=None, dest="license_type", metavar="LICENSE") + parser.add_argument("-m", "--web-manifest", help="Generate a web manifest file.", action="store_true", default=False, dest="generate_webmanifest") + parser.add_argument("-n", "--non-interactive-mode", help="Run in non-interactive mode, disabling progress bars.", action="store_true", default=False, dest="non_interactive_mode") + parser.add_argument("-p", "--root-directory", help="Root directory containing the images.", required=True, type=str, dest="root_directory", metavar="ROOT") + parser.add_argument("-r", "--regenerate-thumbnails", help="Regenerate thumbnails even if they already exist.", action="store_true", default=False, dest="regenerate_thumbnails") + parser.add_argument("-t", "--site-title", help="Title of the image hosting site.", required=True, type=str, dest="site_title", metavar="TITLE") + parser.add_argument("-w", "--web-root-url", help="Base URL of the web root for the image hosting site.", required=True, type=str, dest="web_root_url", metavar="URL") parsed_args = parser.parse_args() _args = Args() _args.author_name = parsed_args.author_name @@ -206,6 +206,8 @@ def generate_thumbnail(arguments: Tuple[str, str]) -> None: folder, item = arguments path = os.path.join(args.root_directory, ".thumbnails", folder.removeprefix(args.root_directory), os.path.splitext(item)[0]) + ".jpg" if not os.path.exists(path) or args.regenerate_thumbnails: + if os.path.exists(path): + os.remove(path) try: with Image.open(os.path.join(folder, item)) as imgfile: img = ImageOps.exif_transpose(imgfile) diff --git a/themes/cornflower.css b/themes/cornflower.css new file mode 100644 index 0000000..447ed09 --- /dev/null +++ b/themes/cornflower.css @@ -0,0 +1,79 @@ +@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"); + +.navbar { + font-weight: bold; + color: #ebebeb; + background-color: #3674e7; + font-weight: 900; +} + +.navbar li a { + font-weight: 800; + color: #ebebeb; +} + +/* Change the link color on hover */ +.navbar li a:hover { + text-decoration: none; + background-color: #1346a4; +} + +.footer { + color: #ebebeb; + background-color: #0e3377; + font-weight: 700; +} + +.footer a { + color: cornflowerblue; + text-decoration: none; +} + +.footer a:hover { + text-decoration: none; +} + +.folders img { + content: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 1024 1024' class='icon' version='1.1' xmlns='http://www.w3.org/2000/svg' fill='%23000000'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0' /%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath d='M853.333333 256H469.333333l-85.333333-85.333333H170.666667c-46.933333 0-85.333333 38.4-85.333334 85.333333v170.666667h853.333334v-85.333334c0-46.933333-38.4-85.333333-85.333334-85.333333z' fill='%233674e7' /%3E%3Cpath d='M853.333333 256H170.666667c-46.933333 0-85.333333 38.4-85.333334 85.333333v426.666667c0 46.933333 38.4 85.333333 85.333334 85.333333h682.666666c46.933333 0 85.333333-38.4 85.333334-85.333333V341.333333c0-46.933333-38.4-85.333333-85.333334-85.333333z' fill='%236495ed' /%3E%3C/g%3E%3C/svg%3E"); + fill: cornflowerblue; +} + +.folders a { + font-weight: 800; + color: #ebebeb; + text-decoration: none; +} + +.folders a:hover { + text-decoration: none; +} + +.row a { + font-weight: 800; + color: cornflowerblue; + text-decoration: none; +} + +.row a:hover { + text-decoration: underline; +} + +.tooltiptext { + font-weight: 600; + background-color: #191313; + +} + +.column img { + background-color: #0a0a0a; +} + + +body { + color: #ebebeb; + background-color: #171717; + font-family: "Montserrat", sans-serif; + font-optical-sizing: auto; + font-weight: 700; + font-style: normal; +} diff --git a/themes/default-dark.css b/themes/default-dark.css index 9d1cae0..dd6326d 100644 --- a/themes/default-dark.css +++ b/themes/default-dark.css @@ -42,6 +42,11 @@ background-color: #313537; } +.column img { + background-color: #0c0d0e; +} + + body { color: #e8e6e3; background-color: #181a1b; diff --git a/themes/default.css b/themes/default.css index cff266c..b061c6f 100644 --- a/themes/default.css +++ b/themes/default.css @@ -42,6 +42,11 @@ background-color: #ddd; } +.column img { + background-color: #888; +} + + body { color: #000; background-color: #fff; diff --git a/themes/kjoe.css b/themes/kjoe.css index 9329362..f2fddec 100644 --- a/themes/kjoe.css +++ b/themes/kjoe.css @@ -14,8 +14,8 @@ /* Change the link color on hover */ .navbar li a:hover { - font-weight: 900; text-decoration: none; + background-color: #470000; } .footer { @@ -30,7 +30,6 @@ } .footer a:hover { - font-weight: 800; text-decoration: none; } @@ -46,7 +45,6 @@ } .folders a:hover { - font-weight: 900; text-decoration: none; } @@ -65,6 +63,11 @@ background-color: #191313; } +.column img { + background-color: #0a0a0a; +} + + body { color: #ebebeb; background-color: #171717; diff --git a/themes/monokai-vibrant.css b/themes/monokai-vibrant.css index d87f60d..2098b58 100644 --- a/themes/monokai-vibrant.css +++ b/themes/monokai-vibrant.css @@ -43,6 +43,11 @@ background-color: #2c313a; } +.column img { + background-color: #0b0c0f; +} + + body { color: #f6f6f6; background-color: #16171d;