AlphaViz

Contrast Color Library

This lightweight library provides a utility method that analyzes any provided background color and automatically chooses the optimal black or white foreground color to ensure maximum visual contrast and readability.

🟠 Algorithm

The library utilizes the HSP Color Model to calculate the brightness of the background color. The formula for this calculation is as follows:
brightness = sqrt(0.299 * R^2 + 0.587 * G^2 + 0.114 * B^2 )
The library chooses black as the foreground color if the brightness exceeds the threshold (default 0.5), and white otherwise.

专业缠论指标: alphaviz.pro/chanlun
Email: contact@alphaviz.pro
Discord: discord.gg/w2fFtNega4
ספריית Pine

ברוח TradingView אמיתית, המחבר פרסם את קוד Pine זה כספריית קוד פתוח כך שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומים אחרים בקוד פתוח, אך השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בספרייה זו?

העתק את השורה הבאה והדבק אותה בסקריפט שלך.