feat(petal): icon and new line diff style
5 files changed, -22/+52
petal/Makefile
@@ -24,11 +24,13 @@ install: all cp -f petal ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/petal mkdir -p ${DESTDIR}${PREFIX}/share/petal- cp -f style.css ${DESTDIR}${PREFIX}/share/petal- chmod 644 ${DESTDIR}${PREFIX}/share/petal/style.css+ cp -f style.css icon.svg ${DESTDIR}${PREFIX}/share/petal+ chmod 644 ${DESTDIR}${PREFIX}/share/petal/style.css\+ ${DESTDIR}${PREFIX}/share/petal/icon.svg uninstall: rm -f ${DESTDIR}${PREFIX}/bin/petal\- ${DESTDIR}${PREFIX}/share/petal/style.css+ ${DESTDIR}${PREFIX}/share/petal/style.css\+ ${DESTDIR}${PREFIX}/share/petal/icon.svg .PHONY: all clean install uninstall
petal/config.def.h
@@ -2,7 +2,7 @@ static const char *root = "/srv/git"; static const char *css = "/style.css"; static const char *clone = "[email protected]:"; static const char *title = "greenhouse";-static const char *mark = "❀";+static const char *icon = "/icon.svg"; static const char *service = "git"; static const int loglimit = 100; static const int maxdepth = 8;
petal/icon.svg
@@ -0,0 +1,26 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">+<style>+.g { stroke: #8cc56b; }+.f { fill: #8cc56b; }+.p { fill: #e58fa6; }+.c { fill: #f6e7a1; }+@media (prefers-color-scheme: light) {+ .g { stroke: #2f6d1a; }+ .f { fill: #2f6d1a; }+ .p { fill: #c2456b; }+ .c { fill: #e8b931; }+}+</style>+<path class="g f" d="M3 28V18a13 13 0 0 1 26 0v10z" fill-opacity=".14" stroke-width="2" stroke-linejoin="round"/>+<path class="g" d="M10 28V6.6M22 28V6.6M3 18h26" stroke-width="1.25" stroke-opacity=".55"/>+<path class="g" d="M16 28v-11" stroke-width="1.6" stroke-linecap="round"/>+<path class="f" d="M16 25.5c-2.6 0-3.6-1.6-3.6-3.1 2.1 0 3.6 1 3.6 3.1zM16 23.5c2.6 0 3.6-1.6 3.6-3.1-2.1 0-3.6 1-3.6 3.1z"/>+<g class="p" transform="translate(16 13.5)">+<ellipse rx="1.6" ry="2.7" transform="translate(0 -2.6)"/>+<ellipse rx="1.6" ry="2.7" transform="rotate(72) translate(0 -2.6)"/>+<ellipse rx="1.6" ry="2.7" transform="rotate(144) translate(0 -2.6)"/>+<ellipse rx="1.6" ry="2.7" transform="rotate(216) translate(0 -2.6)"/>+<ellipse rx="1.6" ry="2.7" transform="rotate(288) translate(0 -2.6)"/>+</g>+<circle class="c" cx="16" cy="13.5" r="1.2"/>+</svg>
petal/petal.c
@@ -374,9 +374,8 @@ logpage(void) repoheader("log"); fputs("<table class=\"log\">\n<thead><tr><th>Date</th>" "<th>Message</th><th class=\"sm\">Author</th>"- "<th class=\"r sm\">Files</th><th class=\"r\">+</th>"- "<th class=\"r\">−</th></tr></thead>\n<tbody>\n",- stdout);+ "<th class=\"r sm\">Files</th><th class=\"r\">Lines</th>"+ "</tr></thead>\n<tbody>\n", stdout); if (*ref && git_revwalk_new(&w, repo) >= 0 && git_revwalk_push(w, &tip) >= 0) { git_revwalk_sorting(w, GIT_SORT_TIME);@@ -440,14 +439,13 @@ logrow(const git_oid *oid) git_diff_get_stats(&stats, diff); if (stats) printf("</td><td class=\"r num sm\">%zu</td>"- "<td class=\"r num ins\">+%zu</td>"- "<td class=\"r num del\">−%zu</td></tr>\n",+ "<td class=\"r num\"><span class=\"del\">-%zu</span>/"+ "<span class=\"ins\">+%zu</span></td></tr>\n", git_diff_stats_files_changed(stats),- git_diff_stats_insertions(stats),- git_diff_stats_deletions(stats));+ git_diff_stats_deletions(stats),+ git_diff_stats_insertions(stats)); else- fputs("</td><td class=\"sm\"></td><td></td><td></td></tr>\n",- stdout);+ fputs("</td><td class=\"sm\"></td><td></td></tr>\n", stdout); git_diff_stats_free(stats); git_diff_free(diff); git_commit_free(commit);@@ -497,12 +495,14 @@ pagebegin(int status, const char *pagetitle) xmlencode(pagetitle); fputs("</title>\n<link rel=\"stylesheet\" href=\"", stdout); xmlencode(css);+ fputs("\">\n<link rel=\"icon\" href=\"", stdout);+ xmlencode(icon); fputs("\">\n</head>\n<body>\n<div id=\"top\"><a class=\"brand\" " "href=\"", stdout); xmlencode(base);- fputs("/\"><b>", stdout);- xmlencode(mark);- fputs("</b> ", stdout);+ fputs("/\"><img src=\"", stdout);+ xmlencode(icon);+ fputs("\" alt=\"\"> ", stdout); xmlencode(title); fputs("</a><nav>", stdout); for (i = 0; i < LENGTH(services); i++) {@@ -701,9 +701,9 @@ printstat(git_diff *diff) fputs("</span></td></tr>\n", stdout); } printf("</table>\n<p class=\"total\">%zu file%s changed, "- "<span class=\"ins\">+%zu</span> "- "<span class=\"del\">−%zu</span></p>\n",- n, n == 1 ? "" : "s", tadd, tdel);+ "<span class=\"del\">-%zu</span>/"+ "<span class=\"ins\">+%zu</span></p>\n",+ n, n == 1 ? "" : "s", tdel, tadd); free(st); } @@ -1153,6 +1153,7 @@ main(void) root = envor("PETAL_ROOT", root); css = envor("PETAL_CSS", css);+ icon = envor("PETAL_ICON", icon); clone = envor("PETAL_CLONE", clone); title = envor("PETAL_TITLE", title); base = envor("SCRIPT_NAME", "");
petal/style.css
@@ -55,9 +55,10 @@ a:hover { border-bottom: 1px dashed var(--dim); } -#top .brand b {- color: var(--petal);- font-weight: normal;+#top .brand img {+ width: 1.3em;+ height: 1.3em;+ vertical-align: -0.3em; } #top nav, header nav {