Trying to write an AFL to basically flip between a dark/light theme.
Went through list of functions a few times and didn't notice anything to change the text color.
Worst case its just a couple extra clicks to change in preferences.
It's so close using SetChartBKGradientFill(),setchartBkColor(), couple variables for plot color and a simple paramtoggle() and if() function.
Theirs functions for bar color and getpricestyle(). So should be super easy to switch color schemes for
bar/candle/line charts depending on dark/light.
1 Like
No, text color of native axes can not be changed via AFL as of yet.
(Only if re-creating axes on your own.)
1 Like
Chart Theme is so much more than background color and text color. So you are mistaken if you could do that with 2 calls. Chart themes are here to be used, not to be circumvented. Consistent look is a goal, not "christmas tree design" with never-twice the same color.
1 Like
Your right Tomasz, I was looking to just switch between a dark background and colored bars and a white background and black/white bars.
I use candles and bars regularly so a quick thinking this morning thought it'd be quite simple. Realized I couldn't figure out how to control the colors of barchart high/low ticks via AFL.
This is all very non important, just a thought this morning.
bkg_color1 = ParamColor("Background Color 1", colorCustom1);
bkg_Color2 = ParamColor("Background Color 2", colorCustom2);
bkg = ParamToggle("White | Black", "White|Black");
if(bkg) // Black
{
SetChartBkGradientFill(bkg_color1,bkg_color2);
Plot_color = colorwhite;
SetChartBkColor(colorBlack);
SetBarFillColor(IIf(C>O,colorDarkBlue,colorRed));
}
else //White
{
SetChartBkGradientFill(colorWhite,colorWhite);
Plot_color = colorblack;
SetChartBkColor(colorWhite);
SetBarFillColor(IIf(C>O,colorWhite,colorBlack));
}
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", Plot_color, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
1 Like