💾 Archived View for bacaliu.de › %CE%B5%E1%BD%96_themes.gmi captured on 2023-11-14 at 08:04:49. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

εὖ-Themes

select a Colorscheme

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 (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 `@media(prefers-colorscheme)'. 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

Stavrou, P. 2022. [“Emacs: introduction to the ef-themes,]” /Protesilaos stavrou/.

“Emacs: introduction to the ef-themes,

Nav

Emacs

Meta

Footer

License: CC BY-4.0 [Impressum und Datenschutz]

Impressum und Datenschutz