diff --git a/.gitignore b/.gitignore index 932c169..0a57095 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ out/ -base16-vim/ +tinted-vim/ base16-schemes/ schemes/ diff --git a/build.sh b/build.sh index 440ab9a..3c49902 100644 --- a/build.sh +++ b/build.sh @@ -2,37 +2,53 @@ set -eu pipefail -rm -rf out -mkdir out +setup() { + rm -rf out + mkdir out -rm -rf base16-vim -git clone --depth=1 https://github.com/tinted-theming/base16-vim + rm -rf tinted-vim + git clone --depth=1 https://github.com/tinted-theming/tinted-vim -rm -rf schemes -git clone --depth=1 https://github.com/tinted-theming/schemes + rm -rf schemes + git clone --depth=1 https://github.com/tinted-theming/schemes +} -export COLORSCHEMES=($(ls schemes/base16/ | grep yaml | sed 's/\..*$//')) +main() { + setup -for COLORSCHEME in ${COLORSCHEMES[@]}; do - echo $COLORSCHEME + colorschemes=($(ls schemes/base16/ | grep yaml | sed 's/\..*$//')) + tmpfile="$0.html" vim -es -u NORC -N \ -c 'silent! set termguicolors' \ -c 'silent! set runtimepath+=base16-vim' \ -c 'silent! syntax on' \ - -c "silent! colorscheme base16-$COLORSCHEME" \ + -c "silent! colorscheme base16-${colorschemes[0]}" \ -c 'silent! TOhtml' \ -c 'silent! wqa!' \ $0 > /dev/null 2>&1 + awk "/
/{flag=1; next} /<\/pre>/{flag=0} flag" $tmpfile > out/shell.html
 
-  grep -Pzo '(?s)' $0.html \
-    | sed "3,14!d;s/body/pre/;s/^/#base16-$COLORSCHEME /" \
-    > out/$COLORSCHEME.css
+  for colorscheme in ${colorschemes[@]}; do
+    echo $colorscheme
 
-  awk "/
/,/<\/pre>/" $0.html \
-    > out/$COLORSCHEME.html
+    vim -es -u NORC -N \
+      -c 'set termguicolors' \
+      -c 'set runtimepath+=tinted-vim' \
+      -c 'syntax on' \
+      -c "colorscheme base16-$colorscheme" \
+      -c 'TOhtml' \
+      -c 'wqall' \
+      $0 > /dev/null 2>&1
 
-  rm -f $0.html
-done
+    grep -Pzo '(?s)' $tmpfile \
+      | sed "3,14!d;s/body/pre/;s/^/#base16-$colorscheme /" \
+      > out/$colorscheme.css
 
-erb template.erb > out/index.html
+    rm -f $tmpfile
+  done
+
+  erb template.erb > out/index.html
+}
+
+main
diff --git a/template.erb b/template.erb
index b73c6d0..d85cbca 100644
--- a/template.erb
+++ b/template.erb
@@ -1,3 +1,22 @@
+<% 
+  require 'yaml'
+  require 'ostruct'
+  require 'json'
+
+  # Collect paths
+  colorscheme_files = Dir['schemes/base16/*.yaml']
+
+  # Parse each file into an OpenStruct object, including the slug
+  colorschemes = colorscheme_files.map do |file_path|
+    slug = File.basename(file_path, '.yaml')
+    
+    data = YAML.load_file(file_path)
+    data['slug'] ||= slug
+    
+    OpenStruct.new(data)
+  end
+%>
+
 
   
     Base16 Gallery
@@ -6,17 +25,20 @@
     
     
     
+    
   
   
@@ -58,42 +89,199 @@
       

Base16 Gallery

- This gallery is generated from tinted-theming/base16-vim.

+ This gallery is generated from tinted-theming/tinted-vim.

+
+
+ Group by variant: +
+
+ Dark mode: