yartsu/scripts/theme-showcase-gen

36 lines
765 B
Text
Raw Normal View History

2022-06-14 18:35:47 -05:00
#!/usr/bin/env bash
THEME_MD="./docs/themes.md"
themes=$(yartsu --list-themes | tail -n +2 | awk '{print $2}')
2022-06-15 13:06:30 -05:00
newline() {
echo >>"$THEME_MD"
}
2022-06-14 18:35:47 -05:00
mkdir -p ./assets/themes
2022-06-15 13:06:30 -05:00
rm -f ./assets/themes/*
2022-06-14 18:35:47 -05:00
rm -f $THEME_MD
2022-06-15 13:06:30 -05:00
echo '<div id="top"></div>' >>$THEME_MD
newline
2022-06-14 18:35:47 -05:00
echo "# Themes" >>$THEME_MD
2022-06-15 13:06:30 -05:00
newline
echo " Available themes:" >>$THEME_MD
for theme in $themes; do
echo "- [$theme](#$(echo $theme | sed s'/_//'))" >>$THEME_MD
done
2022-06-14 18:35:47 -05:00
echo >>$THEME_MD
2022-06-15 13:06:30 -05:00
2022-06-14 18:35:47 -05:00
for theme in $themes; do
url="assets/themes/${theme}.svg"
echo >>$THEME_MD
echo "## $theme" >>$THEME_MD
echo "![$theme](../$url)" >>$THEME_MD
2022-06-15 13:06:30 -05:00
echo '<p align="right">(<a href="#top">back to top</a>)</p>' >>$THEME_MD
yartsu --theme $theme -o $url --demo -t "yartsu --theme ${theme} --demo"
2022-06-14 18:35:47 -05:00
done
echo "finished."