upslidedown

Light or Dark Mode Tutorial - Luminance Detection

As a colorblind trader, I think accessibility is a big deal. This script auto detects the chart background color and optimizes text color based on luminance.

Luminance detection is based on pine script new chart.bg_color feature, allowing lines, tables, etc to be optimized. Thanks to TV team for releasing this in the latest update/blog post today! This makes it simple to optimize scripts based off the knowledge that max luminance = 765 (rgb 255 + 255 + 255), thus we know that lum <= 383 is "dark mode" and lum > 383 is "light mode".

Try changing the chart background color and see how this script changes the table printed on the chart. I hope more script authors will begin to utilize this concept and that even better contrast detection may be built future pine script iterations.

❤️ Pro indicators whop.com/upslidedown/
💎 Chat with me about indicators and strategies: discord.gg/Psf9PV6Urf
💎 Get my %R Trend Exhaustion indicator: bit.ly/prte
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?