This commit is contained in:
retoor 2025-05-18 17:48:22 +02:00
parent c45b61681d
commit e1727caa5f
2 changed files with 37 additions and 6 deletions
gitlog.py
src/snek/templates

View File

@ -8,7 +8,7 @@ import mimetypes
import html
# --- Theme selection (choose one: "light1", "light2", "dark1", "dark2") ---
THEME = "dark2" # Change this to "light2", "dark1", or "dark2" as desired
THEME = "light1" # Change this to "light2", "dark1", or "dark2" as desired
THEMES = {
"light1": """
@ -86,7 +86,7 @@ def HTML_TEMPLATE(content, theme=THEME):
REPO_ROOT = os.path.abspath(".")
LOG_FILE = os.path.join(REPO_ROOT, "gitlog.jsonl")
PORT = 8000
PORT = 8481
def format_diff_to_html(diff_text: str) -> str:
lines = diff_text.strip().splitlines()
@ -107,11 +107,11 @@ def format_diff_to_html(diff_text: str) -> str:
if line.startswith('+++') or line.startswith('---'):
html_lines.append(f'<div style="color: #0000aa;">{escaped}</div>')
elif line.startswith('@@'):
html_lines.append(f'<div style="background-color: #eaf5ff; color: #005cc5;">{escaped}</div>')
html_lines.append(f'<div style="color: #005cc5;">{escaped}</div>')
elif line.startswith('+'):
html_lines.append(f'<div style="background-color: #e6ffed; color: #22863a;">{escaped}</div>')
html_lines.append(f'<div style="color: #22863a;">{escaped}</div>')
elif line.startswith('-'):
html_lines.append(f'<div style="background-color: #ffeef0; color: #b31d28;">{escaped}</div>')
html_lines.append(f'<div style="color: #b31d28;">{escaped}</div>')
elif line.startswith('\\'):
html_lines.append(f'<div style="color: #6a737d;">{escaped}</div>')
else:

View File

@ -14,7 +14,7 @@
* { margin:0; padding:0; box-sizing:border-box; }
body {
font-family: 'Segoe UI',sans-serif;
background: #111;
background: #000;
color: #eee;
line-height:1.5;
}
@ -187,6 +187,7 @@
.btn { width: 100%; box-sizing: border-box; text-align:center; }
}
</style>
<link rel="stylesheet" href="/static/sandbox.css" />
</head>
<body>
@ -284,5 +285,35 @@ snek serve
<p>&copy; 2025 Snek Join our global community of developers, testers &amp; AI enthusiasts.</p>
</footer>
<script>
// number of stars you want
const STAR_COUNT = 200;
const body = document.body;
for (let i = 0; i < STAR_COUNT; i++) {
const star = document.createElement('div');
star.classList.add('star');
// random position within the viewport
star.style.left = Math.random() * 100 + '%';
star.style.top = Math.random() * 100 + '%';
// random size (optional)
const size = Math.random() * 2 + 1; // between 1px and 3px
star.style.width = size + 'px';
star.style.height = size + 'px';
// random animation timing for natural flicker
const duration = Math.random() * 3 + 2; // 2s5s
const delay = Math.random() * 5; // 0s5s
star.style.animationDuration = duration + 's';
star.style.animationDelay = delay + 's';
body.appendChild(star);
}
</script>
</body>
</html>