Official

themes

The stock themes: presets of every colour, type size, corner, density token and background, chosen per light and dark mode and edited in Settings, beside the themes other plugins ship.

The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/themes@0.3.4

Permissions in 0.3.4

  • Change app settings settings.writeHighChanges the app settings.Apply the chosen theme to the window
  • Read files fs.readMediumReads files in the listed places.Find the pictures you chose for backgrounds in this plugin's data folder, to remove the ones no preset usesPlaces: its own data folder
  • Write files fs.writeMediumCreates, changes and deletes files in the listed places.Keep a copy of each picture you choose for a background in this plugin's data folder, so it stays when the original movesPlaces: its own data folder

Files

main.ts1.9 KB
// The stock themes plugin: it sends the kernel the light and dark presets
// the user chose (`kernel/theme.set`) when it starts, whenever its settings
// change (from Settings, from `dvg settings set`, or an edit of the settings
// file), and whenever a plugin loads or reloads, since a chosen preset may
// be one another plugin ships (`shipped.ts`). Its own view in Settings
// edits the presets (`settings.tsx`).
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
import { Events, Kernel, Plugin, Settings, runPlugin } from "divergence/effect";
import { chosen, readSettings } from "./settings-model.ts";
import { refresh, shipped } from "./shipped.ts";

const program = Effect.gen(function* () {
  const plugin = yield* Plugin;
  const kernel = yield* Kernel;
  const settings = yield* Settings;
  const events = yield* Events;
  const apply = Effect.gen(function* () {
    const values = readSettings(plugin.api.settings.get());
    const { themes } = shipped();
    yield* kernel.call("theme.set", { light: chosen(values, "light", themes).tokens, dark: chosen(values, "dark", themes).tokens });
  }).pipe(
    // A kernel without the call (an older app) keeps its built-in look.
    Effect.catch((error) => Effect.sync(() => console.warn(`themes: the theme was not applied (${error.message})`))),
  );
  const reread = Effect.tryPromise(() => refresh(plugin.api)).pipe(
    // A kernel without the call lists no plugin's themes.
    Effect.catch((error) => Effect.sync(() => console.warn(`themes: the plugins' themes were not read (${error.message})`))),
  );
  yield* reread;
  yield* apply;
  yield* Effect.forkScoped(settings.changes.pipe(Stream.runForEach(() => apply)), { startImmediately: true });
  yield* Effect.forkScoped(
    events.stream("plugins_changed").pipe(Stream.runForEach(() => Effect.andThen(reread, apply))),
    { startImmediately: true },
  );
});

export default runPlugin(program);

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.3.5latestNov 21, 2026>=5 <614.2 KB3 permissionsListed
0.3.4Nov 16, 2026>=5 <613.8 KB3 permissionsListed
0.3.3Nov 11, 2026>=5 <68.9 KB1 permissionListed
0.3.2Nov 9, 2026>=5 <68.1 KB1 permissionListed
0.3.1Oct 27, 2026>=2 <48 KB1 permissionListed

Reviews and comments

0 threads · 0 reviews

No comments yet.