luthien-templates

Crates.ioluthien-templates
lib.rsluthien-templates
version0.1.0
sourcesrc
created_at2021-05-18 04:18:08.176205
updated_at2021-05-18 04:18:08.176205
descriptionLuthien plugin which renders Handlebars templates.
homepage
repository
max_upload_size
id398841
size26,516
Max Niederman (max-niederman)

documentation

README

Luthien Templates

luthien-templates renders user-defined Handlebars templates with Luthien theme data.

Installation

Install using Cargo from Crates.io:

cargo install luthien-templates

Configuration

Add a plugin to your Luthien config:

[[plugins]]
executable = "~/.cargo/bin/luthien-templates"

Writing Templates

Mustach templates in the plugin's config directory (should be something like ~/.config/luthien/plugins/templates) will be rendered using the theme data.

Template Data

The data accessible to the template looks like this (in some TypeScript-like pseudocode):

type Color = {
  hex: string;
  hex_stripped: string;
  red: number;
  green: number;
  blue: number;
};

// The RGB channels are sRGB floating-point values from 0 to 1

type Data = {
  wallpaper: string;
  colors: {
    palette: {
      black: Color;
      red: Color;
      green: Color;
      yellow: Color;
      blue: Color;
      purple: Color;
      cyan: Color;
      white: Color;
    };
    accents: Color[];
    foreground: Color;
    background: Color;
  };
};

colors.accents is a list of accent colors in descending order of importance, so low-indexed colors should be used more often. There should be at least 6 accents.

Outputs

The rendered template is then copied into a file in the output directory (should be something like ~/.local/share/luthien/outputs/plugins/templates on Unix-like systems).

Commit count: 0

cargo fmt