Dev:Flipswitch

libflipswitch is a library used to implement a centralized toggle system.

How to make a new switch
Save this NIC template to the  directory and call   to get a premade switch.

Add instructions about writing code.

Glyphs
Glyphs are the visual part of the switch that should represent your switch's state. To create one, you have to create at least two icons (one for  state and one for   state) as black vector images with transparent background. Then, save those vector images as PDF and name them  for the   state and   for the   state. You should then move these PDFs to your  folder, where an   file resides.

Secondary action
In the file  you can find the key "alternate-action-url", which will enable you to open a URI when the secondary action of the switch is invoked, in case it is not implemented in code. The default value is "prefs:".

How to make a template bundle
These bundles contain information about how a switch glyph (the image that the user sees for a given switch) is rendered when it is used in a button returned by the appropriate method of the FlipSwitch panel. Bundles contain an  file and optionally image files. Here is an example of an, taken from SwitchIcons:

Keys not specified in the following table can use the same values as the example given.

array can contain dictionaries with the following keys:

are applied to the button one over the other. If  is "image", the current layer will draw the image found in. Best use of this layer could be as a background. If  is "glyph", the current layer will use the switch glyph as a mask. When  is present, the   will select the glyph for said state. If  is true, the layer will be composed of only the glyph's borders.

It is possible to use a  for each state by creating new   arrays named ,   or.

For more information, see this resource