Difference between revisions of "LGUI2:Templates"

From Lavish Software Wiki
Jump to navigation Jump to search
(Created page with "A LavishGUI 2 Template is a JSON Object which provides values to use when not explicitly given (for example, default values). A LGUI2:Skin is then a collection of Templat...")
 
Line 2: Line 2:
  
 
== Defining a Template ==
 
== Defining a Template ==
Templates are defined as JSON Objects, usually within a [[LGUI2:Skin|Skin]]. Each JSON Object in the Skin's "templates" Object will become a Template with the given name, stored within the Skin.
+
Templates are defined as JSON Objects, usually within a [[LGUI2:Skin|Skin]]. Each JSON Object in the Skin's "templates" Object will become a Template with the given name, stored within the Skin.
 +
 
 +
The properties to provide within each Template depend entirely on how the Template is to be used. See the main [[LGUI2:Skin|Skin]] page for more information.
  
 
== Example ==
 
== Example ==

Revision as of 04:43, 26 May 2018

A LavishGUI 2 Template is a JSON Object which provides values to use when not explicitly given (for example, default values). A Skin is then a collection of Templates which are activated together.

Defining a Template

Templates are defined as JSON Objects, usually within a Skin. Each JSON Object in the Skin's "templates" Object will become a Template with the given name, stored within the Skin.

The properties to provide within each Template depend entirely on how the Template is to be used. See the main Skin page for more information.

Example

{
  "type": "skin",
  "name": "test skin",
  "templates": {
    "window.title": {
      "verticalAlignment": "center",
      "margin": [ 2, 0, 0, 0 ]
    },
    "window.titleBar": {
      "backgroundBrush": {
        "color": [ 0, 0, 1.0 ]
      }
    },
    "contextmenu": {
      "type": "contextmenu",
      "padding": [ 1, 1, 1, 1 ]
    },
    "contextmenuitem": {
      "type": "contextmenuitem",
      "padding": [ 2, 2, 2, 2 ],
      "margin": [ 1, 1, 1, 1 ],
      "styles": {
        "gotMouseOver": {
          "backgroundBrush": {
            "color": [ 0.0, 0.0, 0.3 ]
          },
          "font": {
            "bold": true
          },
          "color": [ 1.0,1.0,0]
        },
        "lostMouseOver": {
          "backgroundBrush": {
            "color": [ 0.0, 0.0, 0.0, 0.0 ]
          },
          "font": {
            "bold": false
          },
          "color": [ 1.0,1.0,1.0]
        }
      }
    }
  }
}