package stk

  1. Overview
  2. Docs

Theming widgets.

Theming is done by defining default properties for Widget.widget classes (the class_ parameter in widget creation) and names (the name parameter in widget creation).

type t

A theme

val variables : t -> Yojson.Safe.t Misc.SMap.t

Get variables of theme.

val get_or_create : string -> t

get_or_create name returns the theme with the given name if it exists, else creates it.

val set_current : t -> unit

set_curent t sets theme t as current theme. It will be used by newly created widgets.

val current : unit -> t

current () returns the current theme.

val init : unit -> unit

init () initializes default themes. It is called by App.init.

val of_class : ?name:string -> string -> Props.t

of_class ?name class_ returns the properies associated to class_ and optional name in current theme.

val load_theme : Misc.SMap.key -> Yojson.Safe.t -> unit

load_theme name json create or modifies theme t from the given JSON description.

val to_json : t -> Yojson.Safe.t

to_json returns a JSON representation of the given theme.

val to_string : t -> string

to_string t returns a JSON string representing the theme t.

val add_class : ?inherits:string list -> string -> Props.t -> unit

add_class ?inherits class_ props associates the properties props to the given class_ in the current theme. inherits specifies which classes this class inherited properties from, in the given order.

val extend_current_from_json : Yojson.Safe.t -> unit

extend_current_from_json json extends current theme with JSON description.

OCaml

Innovation. Community. Security.