No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nnra6864 af9034a75b feat: Accent, link and state colors follow the theme's roles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:48:25 +01:00
.gitignore chore: Ignore build output 2026-11-11 00:53:29 +01:00
App.zig feat: Accent, link and state colors follow the theme's roles 2026-11-12 12:48:25 +01:00
build.zig feat: GTK 4 and adw-gtk3 apps take the theme's colors 2026-11-11 00:53:29 +01:00
build.zig.zon feat: Accent, link and state colors follow the theme's roles 2026-11-12 12:48:25 +01:00
Colors.zig feat: GTK 4 and adw-gtk3 apps take the theme's colors 2026-11-11 00:53:29 +01:00
gtk3.zig feat: GTK 4 and adw-gtk3 apps take the theme's colors 2026-11-11 00:53:29 +01:00
gtkrc.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00
quoting.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00
README.md feat: Accent, link and state colors follow the theme's roles 2026-11-12 12:48:25 +01:00
root.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00
Settings.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00
SettingsFiles.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00
xsettingsd.zig feat: GTK's theme, icons, font and cursor settings are written in place of nwg-look, and set in gsettings 2026-11-11 18:48:48 +01:00

kosm_gtk

GTK for kosm: the theme's colors for GTK 4's libadwaita apps and GTK 3's adw-gtk3 theme, without a generated theme, and GTK's settings (theme, icons, font, cursor), in place of nwg-look. libadwaita draws every widget from its color variables (--window-bg-color, --accent-bg-color, ...), and adw-gtk3 from the matching GTK 3 named colors (@window_bg_color), so setting those recolors the apps.

The app writes a block between /* kosm:begin kosm */ and /* kosm:end */ at the end of each user stylesheet; the rest of the file stays yours:

  • ~/.config/gtk-4.0/gtk.css: :root { --<name>-color: ...; }, read by every GTK 4 app.
  • ~/.config/gtk-3.0/gtk.css: @define-color <name>_color ...; lines (the package's gtk3 adapter). Only themes built on named colors follow them: set the GTK 3 theme to adw-gtk3 (adw-gtk3-dark in dark mode) to use them. Other themes, such as an Oomox one, draw with colors of their own.

Running apps read the stylesheets at start, so restart them after an apply.

The settings are written whole, the way nwg-look writes them, to GTK 3's and GTK 4's settings.ini, GTK 2's ~/.gtkrc-2.0, xsettingsd's config (served to X11 apps when xsettingsd runs) and ~/.icons/default/index.theme (the cursor X apps inherit). On Wayland GTK reads GNOME's settings before settings.ini, and libadwaita takes dark mode from them, so after every apply the app also sets the matching gsettings keys of org.gnome.desktop.interface and org.gnome.desktop.sound; a failure is a warning, like a reload. The GTK_THEME environment variable overrides the theme everywhere: leave it unset.

from(theme) sets the GTK theme to adw-gtk3-dark (adw-gtk3 in light mode) and gtk_application_prefer_dark_theme from the mode. It sets windows from the theme's background role with its surface steps, text from the foreground role, the accent and the error (also destructive), success and warning roles, each with readable text from the theme's contrast.on; shadows and the scrollbar outline are the theme's surface.shadow. Windows, the tab overview and the active toggle take the theme's background_alpha, so a translucent kosmos makes GTK apps translucent like its terminals. GTK paints header bars, sidebars, views, cards and thumbnails over the window's own background, and two translucent layers stack to a higher alpha, so these are written as fainter tints (the alpha squared) with their color pushed away from the window's: stacked, they show their color at close to the window's alpha (0.625 for 0.5). Popovers, dialogs, borders and the accent and state colors stay opaque so they read over any content.

Fields

Field Default
gtk4 ~/.config/gtk-4.0/gtk.css, created when missing; null writes nothing for GTK 4
gtk3 ~/.config/gtk-3.0/gtk.css, created when missing; null writes nothing for GTK 3
settings every setting null but gtk_theme_name and gtk_application_prefer_dark_theme; named as in settings.ini (gtk_icon_theme_name, gtk_font_name, gtk_cursor_theme_name, gtk_cursor_theme_size, toolbar, sound and gtk_xft_* settings), plus gsettings' monospace_font_name and document_font_name; null is not written
settings_files gtk3, gtk4 (settings.ini), gtk2 (~/.gtkrc-2.0), xsettingsd (~/.config/xsettingsd/xsettingsd.conf), cursor (~/.icons/default/index.theme, only with a cursor theme); null writes nothing there
gsettings true: every apply sets the matching gsettings keys
colors every libadwaita color without -- and -color (window_bg, accent_bg, headerbar_shade, error, ...); active_toggle_* and overview_* are GTK 4 only; null leaves each to the theme