logo

G6

  • Docs
  • API
  • Playground
  • Community
  • Productsantv logo arrow
  • 5.0.45
  • Data
  • Canvas Operations
  • Element Operations
  • Graph Instance
  • Drawing and Rendering
  • Viewport Operations
  • Layout
  • Graph Options
  • Behavior
  • Plugin
  • Theme
  • Data Transformation
  • Event Listening
  • Coordinate Transformation
  • Export Image

Theme

Previous
Plugin
Next
Data Transformation

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Overview of Theme

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.

API Reference

Graph.getTheme()

Get the theme

getTheme(): ThemeOptions;
Related Parameters

Return Value:

  • Type: false | 'light' | 'dark' | string

  • Description: Current theme

Graph.setTheme(theme)

Set the theme

setTheme(theme: ThemeOptions | ((prev: ThemeOptions) => ThemeOptions)): void;

Example

graph.setTheme('dark');
Related Parameters

Parameter

Type

Description

theme

false | 'light' | 'dark' | string | ((prev: false | 'light' | 'dark' | string) => false | 'light' | 'dark' | string)

Theme name

Return Value:

  • Type: void

Type Definitions

ThemeOptions

type ThemeOptions = {
// Colors used in the theme
colors: string[];
// Node style settings
nodeStyle?: {
fill: string;
stroke: string;
};
// Edge style settings
edgeStyle?: {
stroke: string;
};
// Additional configuration options for the theme
[configKey: string]: any;
};