172.3. kdos-theme-2.0.0
KDOS identity generators — KDE colour schemes, editor themes, Konsole, qt5ct, wallpapers, greeter palette
| Version | 2.0.0, release 1 |
| Source tree | src/art/kdos-theme/ |
| Phase | 41_system (System), 957 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 183.9 KiB in 9 files |
| Recipe | src/art/kdos-theme/kpkgbuild |
About
kdos-theme is the build-time generator of KDOS’s identity kit. Every colour KDOS hands to KDE is written by it, from the eight schemes of libkcolor’s KCOL_SCHEMES and from nothing else, so the boot menu, the console, the greeter and the desktop cannot disagree about what an accent is. It runs in the build.sh of the ports that install what it writes, never in a session:
| Subcommand | Writes | For |
|---|---|---|
kde-colors <outdir> |
KDOS<Title>.colors, one KColorScheme file per accent, and KDOSBox.colors for a box with none |
/usr/share/color-schemes, installed by kdos-plasma-look |
syntax-themes <outdir> |
KDOS-<Title>.theme, one KSyntaxHighlighting theme per accent |
/usr/share/org.kde.syntax-highlighting/themes, installed by this port |
konsole <outdir> |
KDOS-<Title>.colorscheme and KDOS-<Title>.profile per accent |
/usr/share/konsole, installed by kdos-plasma-look |
qt5ct-colors <outdir> |
KDOS-<Title>.conf, the Qt 5 palette per accent |
/usr/share/qt5ct/colors, installed by kdos-plasma-look |
wallpaper <outdir> --src MARK.png [--size WxH]… |
KDOS-<Title>/, a Plasma wallpaper package per accent |
/usr/share/wallpapers, installed by kdos-wallpapers |
greeter-globals <file> [accent] |
the colour groups, merged into an existing kdeglobals | the kdeglobals a process outside a Plasma session reads |
greeter-globals --sddm <outdir> |
<accent>/{kdeglobals,plasmarc,kcminputrc} per accent, and background.png, the dark picture of the accent the greeter shows, dimmed until the greeter’s text reads on it |
the three files the sddm user’s ~/.config takes for the system accent, and the greeter’s background |
contrast [-q] FILE… |
a table (none with -q), and exit status 1 when any role is below its floor |
the gate in testing/selftest.sh, and any build.sh that installs a scheme |
accents [--long \| --default] |
the accent names; --long adds the title, light or dark, and the scheme the greeter shows |
a build.sh that makes one file per accent |
With no accent named, a generator writes all eight. The KDE role mapping, the contrast floors, why a dark accent’s selection carries text and why the window ground is deep moved towards grey are in How the theme is generated.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/src-art.txt:
The identity generators (src/art, ours): KDE colour schemes, Konsole profiles, qt5ct palettes, wallpapers and the greeter's palette, all from libkcolor's one table, run at build time so python3 is not a runtime dependency of the shipped system.
Sources
None: the port builds from its own directory, /kdos/src/art/kdos-theme.
Dependencies
Depends on: libpng.
Required by (3): kdos-plasma-look, kdos-sddm-theme, kdos-wallpapers.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install kdos-theme'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/art/kdos-theme.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kdos-theme
SRC=$SRC_ROOT/kdos-theme-2.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
LIBS="$PORT_SRC/../../libs"
gcc $CFLAGS -O2 -std=gnu11 -D_GNU_SOURCE -Wall -Wextra \
-I"$LIBS/libkbase" -I"$LIBS/libkcolor" -I"$PORT_SRC" \
-o kdos-theme \
"$PORT_SRC"/*.c \
"$LIBS"/libkbase/*.c "$LIBS"/libkcolor/*.c -lpng -lm $LDFLAGS
install -Dm755 kdos-theme "$PKG/usr/bin/kdos-theme"
./kdos-theme syntax-themes "$PKG/usr/share/org.kde.syntax-highlighting/themes"
The switches, and why each is set:
-std=gnu11,-D_GNU_SOURCE— The C dialect, and the macro that exposes the C library’s GNU and POSIX extensions to the program and the two libraries compiled with it. The tree’sCFLAGSalready names the same-std.-I"$LIBS/libkbase",-I"$LIBS/libkcolor",-I"$PORT_SRC"— The headers of the two libraries it uses and of the program itself.$LIBSissrc/libs, reached from the port directory."$LIBS"/libkbase/*.c,"$LIBS"/libkcolor/*.c— Compile both libraries into the binary. Alibk*library is a directory of sources, never an installed archive; see How the libraries are built.-lpng— The wallpaper generator reads the mark and writes the wallpapers through libpng, which is independs.-lm— The C library’s maths: the model of the shades KColorScheme derives from a window background works on a 2.2 power curve, and the chroma it is measured by on a cube root.-O2,-Wall,-Wextra— The tree’s optimisation level, named again, and the compiler’s common and extra warnings.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kdos-theme, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kdos-theme-2.0.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kdos-theme, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: contrast.c, ini.c, kdecolors.c, kdos-theme.h, konsole.c, main.c, qt5ct.c, roles.c, shade.c, syntax.c, wallpaper.c.
Contents
Installed programs: kdos-theme.
Installed directories: /usr/share/org.kde.syntax-highlighting/themes.
Notes
kde-colors and both forms of greeter-globals measure the palette before they write a byte and die when a role misses its floor:
- 4.5:1 for every text role and 3:1 for every decoration, each against both backgrounds of its colour set;
- 4.5:1 for the selection’s text on the Selection set’s hover colour, which GTK fills a hovered selected row with;
- 4.5:1 for the view’s text over the selection laid at 64% over the view;
- 4.5:1 for the window titles;
- a chroma ceiling on the five shades KColorScheme derives from the window background.
kde-colors also dies when KDOSBox’s title bars measure under 1.5:1 against any accent’s, and syntax-themes when a syntax colour misses 4.5:1 on the editor or the selection. A scheme that fails is therefore a failed build of the port that installs it, never an installed scheme. contrast measures the files as written, so a file edited after it was generated is measured as it is, and it derives the shades at the file’s own [KDE] contrast, or at KDE’s default of 7 when the file carries none, which is what KColorScheme does. greeter-globals writes [KDE] contrast into the kdeglobals it merges for that reason.
The shade model in shade.c is KColorScheme’s shade() over KGuiAddons’ KHCY colour space, step for step, to the 8-bit colour Qt paints. It has to move with KColorScheme: a release that changes the derivation leaves the gate measuring colours no program draws.
The greeter draws the user’s name, “Login Failed” and its clock in the Complementary set’s text straight over its picture, and the dark wallpaper’s penguin has a nearly white belly behind the name. greeter-globals --sddm therefore reads the dark picture at the largest size a wallpaper package carries, from /usr/share/wallpapers (or the root $KDOS_WALLPAPERS names, which the selftest points at wallpapers it generates), takes every channel above the scheme’s ground toward that ground by one factor in linear light, and writes the result as a PNG. The picture’s ground therefore comes out as the scheme’s ground with its tint, as the lock screen’s wallpaper shows it, and the penguin’s black body stays black; scaling every channel toward black instead takes phosphor’s (0,10,3) ground to a neutral near-black that the greeter shows as grey. The factor is solved so the brightest pixel holds 4.5:1 against that text, then measured on the written pixels and stepped down until it does; the selftest checks that phosphor’s picture keeps its wallpaper’s corner pixel. Holding the brightest pixel bounds every crop a screen’s aspect takes and the blur Breeze lays under the login, because a blur never brightens past the brightest pixel it averages. A missing or unreadable picture fails the run.
build.sh runs the binary it has just linked to write the editor themes, so this port, unlike the other generators’ consumers, installs files of its own beside /usr/bin/kdos-theme.
The recipe hash of a port of KDOS’s own covers its own directory and all of src/libs, and nothing else. An edit to libkcolor’s palette therefore rebuilds this port and every port that runs it, but an edit to this program’s own sources rebuilds this port alone (and its editor themes): kdos-plasma-look and kdos-wallpapers keep the files the old generator wrote until they are rebuilt with it (--rebuild kdos-theme,kdos-wallpapers,kdos-plasma-look). A colour that appears in a shipped KDE file and is not one of these generators’ outputs is a second copy of the palette.
The sixteen terminal colours of the Konsole schemes are libkcolor’s kcol_ansi(), the same derivation kdos theme writes into tmux, btop and the other terminal programs, so a terminal program’s status line and the terminal under it agree about blue.
The profiles set WordModeCoding=false: Konsole otherwise draws the characters programming ligatures are made of as one run, and JetBrains Mono joins != or -> into a single glyph, where a terminal has to show what was typed. They open a new window at 120 columns by 31 rows (TerminalColumns, TerminalRows): the skeleton’s 30-line fastfetch and the prompt under it fit whole, which Konsole’s own 110 by 28 scrolls the logo’s top out of, and the window, about 1110 by 700 pixels at the profiles’ 11-point face, still fits a 1366x768 screen above the panel.