💾 Archived View for bacaliu.de › %CE%B5%E1%BD%96_themes.md captured on 2023-07-10 at 13:48:18.
-=-=-=-=-=-=-
# select a Colorscheme {{list_colors() | safe}} {{lazy_load("set_colors", "/data/colors.set") | safe}} import numpy def doing(): for i in range(0, 42): print(f"{i}^2 equals {i**2:.4d}") # about:colorscheme Protesilaos Stavrou, creator of the modus-themes, recently made more themes with high contrast: the εὖ-Themes (<a href="#citeproc_bib_item_1">Stavrou 2022</a>). Until now my css-file (which currently is still named `modus.css`) contained a light and a dark theme depending on the media-query . The colors were hard-coded into the css-file. This is still the case, for fallback reasons. I can still use the same css-file to create plain HTML-documents for lecture-notes and any visitor who don't specifies their preference get the most accessable choice. To allow more schemes, I need them to be in a seperate file to load them when needed. There are a few steps. ## Create a css-version of the theme From within Emacs calling `ef-themes-list-colors` I got a buffer with following structure #111111 #111111 bg-main #cfdfd5 #cfdfd5 fg-main #222522 #222522 bg-dim #808f80 #808f80 fg-dim #303230 #303230 bg-alt ... By pasting the contents into files named `<name>.src` and using this small shell-script I got the css. #!/usr/bin/env sh for file in $(command ls | grep "src$"); do out=$(echo "$file" | sed 's/\.src/\.css/g') echo ":root{" > "$out" sed 's/\(#[0-9a-f]\{6\}\).\{25\}\s*\(.*\)/ --\2: \1;/g' \ "$file" >> "$out" echo "}" >> "$out" done ## Preparing the main css-file A few names changed, but mostly the old css-file using the modus-themes worked. I made sure to use the semantic colors (like `--link` for links and `--keyword` inside src-blocks) instead of hard-coded versions like `--blue-warmer` etc. ## selecting the themes Instead of using cookies and needing to get inside the european laws of Datenschutz, I just hash the ip-address, the user-agent together with the current date and save a file named after this hash with the user's preference. Therefore every 24 hours you must enter your choice again. # Bibliography <style>.csl-entry{text-indent: -0; margin-left: 0;}</style><div class="csl-bib-body"> <div class="csl-entry"><a id="citeproc_bib_item_1"></a>Stavrou, P. 2022. <a href="https://protesilaos.com/codelog/2022-08-15-intro-ef-themes-emacs">“Emacs: introduction to the ef-themes,</a>” <i>Protesilaos stavrou</i>.</div> </div> # Nav - Tags: [Emacs](./tags/Emacs.md) - [Meta](./tags/Meta.md) <!-- BEGIN insert Backlinks (but there are no) --> - Formats: [md](./εὖ_themes.md) - [txt](./εὖ_themes.txt) - [html](./εὖ_themes.html) - [gmi](./εὖ_themes.gmi) # Footer License: CC BY-4.0 [Impressum und Datenschutz](./impressum-datenschutz.gmi)