Theme
Previous
Plugin
Next
Data Transformation
Loading...
G6 allows users to customize the appearance of graphs through themes. Themes can be used to define colors, shapes, and styles for nodes, edges, and other graph elements.
Get the theme
getTheme(): ThemeOptions;
Return Value:
Type: false | 'light' | 'dark' | string
Description: Current theme
Set the theme
setTheme(theme: ThemeOptions | ((prev: ThemeOptions) => ThemeOptions)): void;
Example
graph.setTheme('dark');
Parameter | Type | Description |
---|---|---|
theme | false | 'light' | 'dark' | string | ((prev: false | 'light' | 'dark' | string) => false | 'light' | 'dark' | string) | Theme name |
Return Value:
type ThemeOptions = {// Colors used in the themecolors: string[];// Node style settingsnodeStyle?: {fill: string;stroke: string;};// Edge style settingsedgeStyle?: {stroke: string;};// Additional configuration options for the theme[configKey: string]: any;};