palette and themes
This commit is contained in:
@@ -3,6 +3,7 @@ import {invokeCallbacks, prototype} from "@/common.js";
|
||||
import {DataFeed, initFeeDropdown, lookupSymbol} from "@/charts/datafeed.js";
|
||||
import {intervalToSeconds, SingletonCoroutine} from "@/misc.js";
|
||||
import {useStore} from "@/store/store.js";
|
||||
import {tvCustomThemes} from "../../theme.js";
|
||||
|
||||
export let widget = null
|
||||
export let chart = null
|
||||
@@ -82,6 +83,8 @@ export function initWidget(el) {
|
||||
disabled_features: [],
|
||||
enabled_features: ['saveload_separate_drawings_storage'],
|
||||
drawings_access: {type: 'white', tools: [],}, // show no tools
|
||||
custom_themes: tvCustomThemes,
|
||||
theme: 'dark',
|
||||
});
|
||||
|
||||
// debug dump all events
|
||||
@@ -94,12 +97,15 @@ export function initWidget(el) {
|
||||
widget.subscribe('mouse_up', mouseUp)
|
||||
widget.headerReady().then(()=>initFeeDropdown(widget))
|
||||
widget.onChartReady(initChart)
|
||||
console.log('tv widget initialized')
|
||||
}
|
||||
|
||||
|
||||
function initChart() {
|
||||
console.log('init chart')
|
||||
chart = widget.activeChart()
|
||||
const themeName = useStore().theme;
|
||||
widget.changeTheme(themeName).catch((e)=>console.warn(`Could not change theme to ${themeName}`, e))
|
||||
chart.crossHairMoved().subscribe(null, (point)=>setTimeout(()=>handleCrosshairMovement(point),0) )
|
||||
chart.onSymbolChanged().subscribe(null, changeSymbol)
|
||||
chart.onIntervalChanged().subscribe(null, changeInterval)
|
||||
@@ -110,7 +116,7 @@ function initChart() {
|
||||
// chart.onHoveredSourceChanged().subscribe(null, ()=>console.log('hovered source changed', arguments))
|
||||
// chart.selection().onChanged().subscribe(null, s => console.log('selection', chart.selection().allSources()));
|
||||
const symbolExt = chart.symbolExt();
|
||||
console.log('symbolExt', symbolExt);
|
||||
// console.log('symbolExt', symbolExt);
|
||||
if(symbolExt) {
|
||||
changeSymbol(symbolExt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user