added cornflower theme

This commit is contained in:
2024-07-09 15:44:09 +02:00
committed by Flo Greistorfer
parent 3376385a17
commit b59abf9f16
7 changed files with 120 additions and 19 deletions

View File

@@ -102,7 +102,8 @@
"themes/default.css", "themes/default.css",
"--use-fancy-folders", "--use-fancy-folders",
"--web-manifest", "--web-manifest",
"-n" "-n",
"-r"
], ],
"postDebugTask": "Delete Lockfile" "postDebugTask": "Delete Lockfile"
}, },
@@ -120,10 +121,11 @@
"-t", "-t",
"Pictures", "Pictures",
"--theme", "--theme",
"themes/kjoe.css", "themes/cornflower.css",
"--use-fancy-folders", "--use-fancy-folders",
"--web-manifest", "--web-manifest",
"-n" "-n",
"-r"
], ],
"postDebugTask": "Delete Lockfile 2" "postDebugTask": "Delete Lockfile 2"
} }

View File

@@ -31,7 +31,7 @@ FAVICON_PATH = ".static/favicon.ico"
GLOBAL_CSS_PATH = ".static/global.css" GLOBAL_CSS_PATH = ".static/global.css"
DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css") DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css")
DEFAULT_AUTHOR = "Author" 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"] 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"] IMG_EXTENSIONS = [".jpg", ".jpeg"]
EXCLUDES = [".lock", "index.html", "manifest.json", ".sizelist.json", ".thumbnails", ".static"] EXCLUDES = [".lock", "index.html", "manifest.json", ".sizelist.json", ".thumbnails", ".static"]
@@ -72,21 +72,21 @@ class Args:
# fmt: off # fmt: off
def parse_arguments() -> Args: def parse_arguments() -> Args:
parser = argparse.ArgumentParser(description="Generate HTML files for a static image hosting website.", formatter_class=RichHelpFormatter) 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("--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("-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("--generate-help-preview", action=HelpPreviewAction, path="help.svg")
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("--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("-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("--theme-path", help="Path to the CSS theme file.", default=DEFAULT_THEME_PATH, type=str, dest="theme_path", metavar="PATH") 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("--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("--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() parsed_args = parser.parse_args()
_args = Args() _args = Args()
_args.author_name = parsed_args.author_name _args.author_name = parsed_args.author_name
@@ -206,6 +206,8 @@ def generate_thumbnail(arguments: Tuple[str, str]) -> None:
folder, item = arguments folder, item = arguments
path = os.path.join(args.root_directory, ".thumbnails", folder.removeprefix(args.root_directory), os.path.splitext(item)[0]) + ".jpg" 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 not os.path.exists(path) or args.regenerate_thumbnails:
if os.path.exists(path):
os.remove(path)
try: try:
with Image.open(os.path.join(folder, item)) as imgfile: with Image.open(os.path.join(folder, item)) as imgfile:
img = ImageOps.exif_transpose(imgfile) img = ImageOps.exif_transpose(imgfile)

79
themes/cornflower.css Normal file
View File

@@ -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;
}

View File

@@ -42,6 +42,11 @@
background-color: #313537; background-color: #313537;
} }
.column img {
background-color: #0c0d0e;
}
body { body {
color: #e8e6e3; color: #e8e6e3;
background-color: #181a1b; background-color: #181a1b;

View File

@@ -42,6 +42,11 @@
background-color: #ddd; background-color: #ddd;
} }
.column img {
background-color: #888;
}
body { body {
color: #000; color: #000;
background-color: #fff; background-color: #fff;

View File

@@ -14,8 +14,8 @@
/* Change the link color on hover */ /* Change the link color on hover */
.navbar li a:hover { .navbar li a:hover {
font-weight: 900;
text-decoration: none; text-decoration: none;
background-color: #470000;
} }
.footer { .footer {
@@ -30,7 +30,6 @@
} }
.footer a:hover { .footer a:hover {
font-weight: 800;
text-decoration: none; text-decoration: none;
} }
@@ -46,7 +45,6 @@
} }
.folders a:hover { .folders a:hover {
font-weight: 900;
text-decoration: none; text-decoration: none;
} }
@@ -65,6 +63,11 @@
background-color: #191313; background-color: #191313;
} }
.column img {
background-color: #0a0a0a;
}
body { body {
color: #ebebeb; color: #ebebeb;
background-color: #171717; background-color: #171717;

View File

@@ -43,6 +43,11 @@
background-color: #2c313a; background-color: #2c313a;
} }
.column img {
background-color: #0b0c0f;
}
body { body {
color: #f6f6f6; color: #f6f6f6;
background-color: #16171d; background-color: #16171d;