import { ExtensionCategory } from '../constants';
import { getExtension } from '../registry/get';
import type { GraphOptions } from '../spec';
import { print } from './print';
/**
* 获取主题配置
*
* Get theme options
* @param options - 图配置项 graph options
* @returns 主题配置 theme options
*/
export function themeOf(options: GraphOptions) {
const { theme } = options;
if (!theme) return {};
const themeOptions = getExtension(ExtensionCategory.THEME, theme);
if (themeOptions) return themeOptions;
print.warn(`The theme of ${theme} is not registered.`);
return {};
}