💾 Archived View for bacaliu.de › %CE%B5%E1%BD%96_themes.txt captured on 2023-07-10 at 13:48:23.
-=-=-=-=-=-=-
━━━━━━━━━━━━━━━━━ ΕΥ̓͂-THEMES all the colors! ━━━━━━━━━━━━━━━━━ 2023-03-18 1 select a Colorscheme ══════════════════════ ┌──── │ import numpy │ def doing(): │ for i in range(0, 42): │ print(f"{i}^2 equals {i**2:.4d}") └──── Listing 1: Preview 2 about:colorscheme ═══════════════════ Protesilaos Stavrou, creator of the modus-themes, recently made more themes with high contrast: the εὖ-Themes (Stavrou 2022). 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. 2.1 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 └──── Listing 2: Theme-to-css-conversion 2.2 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. 2.3 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. 3 Bibliography ══════════════ Stavrou, P. 2022. [“Emacs: introduction to the ef-themes,]” /Protesilaos stavrou/. [“Emacs: introduction to the ef-themes,] <https://protesilaos.com/codelog/2022-08-15-intro-ef-themes-emacs> Nav ═══ ⁃ Tags: [Emacs] - [Meta] ⁃ Formats: [md] - [txt] - [html] - [gmi] [Emacs] <./tags/Emacs.org> [Meta] <./tags/Meta.org> [md] <./εὖ_themes.md> [txt] <./εὖ_themes.txt> [html] <./εὖ_themes.html> [gmi] <./εὖ_themes.gmi> Footer ══════ License: CC BY-4.0 [Impressum und Datenschutz] [Impressum und Datenschutz] <./impressum-datenschutz.gmi>