Themes - obdasystems/grapholscape GitHub Wiki
A theme in Grapholscape is a set of colours applied to the UI widgets and to the graph.
Colours
-
UI colours
primary: used mainly for widgets surface colouron-secondary: used for text on a surface havingprimarycolour as backgroundprimary-darkandon-primary-dark: used for convey lower z-levelssecondary: used as contrast to the primary for highlighting interactive objects and headerson-secondary: used for text on a surface havingsecondarycolour as backgroundsecondary-darkandon-secondary-dark: used for convey lower z-levelsshadows: used for shadows and borderserror: used for error messageson-error: used for text on surfaces havingerroras background colour
-
Graph colours
background: canvas backgroundedge: edges colournode-bg: default nodes background colournode-bg-contrast: used for nodes that are black in the black/white version of Graphol (i.e. range restrictions)node-border: border colours for nodeslabel-colour: colour for labelslabel_colour_contrast: colour for labels opposite to the previous one [not used]
-
Entities colours (optional)
role: used on object properties nodes as background,role_dark: as border and edges of type role in simplified modesattribute: used on data properties nodes as backgroundattribute_dark: as border and edges of type attribute in simplified modesconcept: used on classes nodes as backgroundconcept_dark: as borderindividual: used on individual nodes as backgroundindividual_dark: as border
Default Theme Customization
It is possible to choose the default theme among the predefined ones or defining a custom one. In both cases it is necessary to specify it in the custom default settings. read more about default settings customization.
Setting predefined theme as default
Simply specify the name of the predefined theme in custom settings at the key theme.
Example - dark theme as default theme
const defaultSettings = {
theme : 'dark'
}
const grapholscape = new Grapholscape(grapholFile, container, defaultSettings)
grapholscape.then( ... )
Predefined Themes : gscape, dark, classic
Defining a new default custom theme
It is possible to define new theme specifying each colour in the custom settings at the theme entry.
This time the value will not be a string but an object whose properties are the colours with their values.
The new theme will be based on the light theme of Grapholscape, this means that all unspecified colours will not be overwritten.
You can use two special keys:
name(String): the name that will be displayed to the user in the setting panel.Default:
name = Custom[i]where[i]is a numberselected(Boolean): for telling Grapholscape whether to apply the theme or not, if false it will be defined and registered in themes list and the user can select it in setting panel.Default:
selected = true
Example - using 'red' as secondary colour
const defaultSettings = {
theme : {
secondary : 'red',
name: 'Red Passion Theme',
selected: true
}
}
const grapholscape = new Grapholscape(grapholFile, container, defaultSettings)
grapholscape.then( ... )