#!/bin/bash . "$(sfpath)" || exit 3 shellfu import pretty xd2html() { local name color while read -r line; do name="${line%%:*}" color="${line##*:}" test -n "$name" || continue test -n "$color" || continue debug -v name color test "$name" == "URxvt.background" && echo "$color" > "$Tmp/bg" test "$name" == "URxvt.foreground" && echo "$color" > "$Tmp/fg" echos "

$name

" done } htmlhead() { echos "" echos "" echos " " echos " $File" echos " " echos " " echos " " } htmltail() { echos " " echos "" } mkcss() { echos "body {" echos " font-size: xx-large;" echos " font-family: monospace;" echos " color: $(cat "$Tmp/fg");" echos " background-color: $(cat "$Tmp/bg");" echos "}" } mkhtml() { htmlhead <"$File" xd2html htmltail } main() { local File=$1 local Tmp Tmp=$(mktemp -dt mkdemo.XXXXXXXX) test -n "$File" || mkusage "scheme.Xresources" mkhtml > "$File.html" debug -f "$Tmp/fg" "$Tmp/bg" test -s "$Tmp/fg" || die "failed to parse URxvt.foreground" test -s "$Tmp/bg" || die "failed to parse URxvt.background" mkcss > "$File.css" rm -r "$Tmp" } main "$@"