The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
theme.c File Reference

idunn: the design tokens and the theme file. More...

#include "idunn_theme.h"
#include <string.h>

Functions

void idunn_theme_default (idunn_theme_t *theme)
 the default theme: dark, rose, 13 px text, 6 px radius.
bool idunn_theme_fit (idunn_theme_t *theme, int32_t screen_width)
 set the scale for a screen when the theme's scale is auto.
void idunn_theme_from_conf (idunn_theme_t *theme, const conf_t *conf)
 a theme from a theme file (or from text, for tests); missing or bad values keep their defaults.
void idunn_theme_load (idunn_theme_t *theme)
 read the user's theme (conf_open("theme")).
const char * idunn_color_name (idunn_color_t which)
 the name of a colour token in the theme file ("muted-foreground"), or NULL.
int32_t idunn_radius (const idunn_theme_t *theme)
 buttons, inputs, list rows
int32_t idunn_radius_sm (const idunn_theme_t *theme)
 check boxes, small items in menus: half the radius
int32_t idunn_radius_lg (const idunn_theme_t *theme)
 cards, dialogs, popovers, windows: the radius + 4
idunn_text_style_t idunn_text_style (const idunn_theme_t *theme, idunn_text_t which)
 a text style at the theme's font size and scale.
int idunn_shadow (const idunn_theme_t *theme, idunn_shadow_t which, gfx_shadow_t layers[IDUNN_SHADOW_LAYERS])
 the layers of a shadow, in the order to draw them (the CSS list from its end), at the theme's scale.

Detailed Description

idunn: the design tokens and the theme file.

the values are the agreed look (plans/idunn-ui-plan.md, section 2, and the "refined" preview). a theme is made in four steps: the table of its mode, the accent, the tokens made from the accent, and last the tokens the theme file changes for the mode.

Function Documentation

◆ idunn_theme_default()

void idunn_theme_default ( idunn_theme_t * theme)

the default theme: dark, rose, 13 px text, 6 px radius.

◆ idunn_theme_fit()

bool idunn_theme_fit ( idunn_theme_t * theme,
int32_t screen_width )

set the scale for a screen when the theme's scale is auto.

Returns
true if the scale changed.

◆ idunn_theme_from_conf()

void idunn_theme_from_conf ( idunn_theme_t * theme,
const conf_t * conf )

a theme from a theme file (or from text, for tests); missing or bad values keep their defaults.

◆ idunn_theme_load()

void idunn_theme_load ( idunn_theme_t * theme)

read the user's theme (conf_open("theme")).

◆ idunn_color_name()

const char * idunn_color_name ( idunn_color_t which)

the name of a colour token in the theme file ("muted-foreground"), or NULL.

◆ idunn_radius()

int32_t idunn_radius ( const idunn_theme_t * theme)

buttons, inputs, list rows

◆ idunn_radius_sm()

int32_t idunn_radius_sm ( const idunn_theme_t * theme)

check boxes, small items in menus: half the radius

◆ idunn_radius_lg()

int32_t idunn_radius_lg ( const idunn_theme_t * theme)

cards, dialogs, popovers, windows: the radius + 4

◆ idunn_text_style()

idunn_text_style_t idunn_text_style ( const idunn_theme_t * theme,
idunn_text_t which )

a text style at the theme's font size and scale.

◆ idunn_shadow()

int idunn_shadow ( const idunn_theme_t * theme,
idunn_shadow_t which,
gfx_shadow_t layers[IDUNN_SHADOW_LAYERS] )

the layers of a shadow, in the order to draw them (the CSS list from its end), at the theme's scale.

Returns
the number of layers (at most IDUNN_SHADOW_LAYERS).