PINE LIBRARY
已更新 Color

Utility for working with colors.
Get the luminosity of a color and determine the optimal (black or white) foreground color.
Get the luminosity of a color and determine the optimal (black or white) foreground color.
發行說明
v2Added:
equals(color a, color b) function that deals with na values.
發行說明
v3Added:
tostringRGBT(color)
Converts a color value to a string in the "rgbt(r,g,b,t)" format.
Parameters:
color: The color to convert.
Returns: The color value as a string.
toHexChar(n)
Converts an integer between 0 and 15 to its hex equivalent character.
Parameters:
n: The integer value to convert.
byteToHex(n)
Converts an integer from 0 to 255 to a 2-character hex string.
Parameters:
n: The integer value to convert.
toHex(color)
Converts a color to its hex string (#FFFFFF).
Parameters:
color
Returns: The six digit hex string.
發行說明
v4Updated:
getContrastColor(bgColor, keepNa)
Returns a color that is either black or white depending on the luminosity of the given background color. If the background color is na, returns gray.
Parameters:
bgColor: The background color to determine the contrast color for.
keepNa: When true and the value of bgColor is na the return value will be na; otherwise the if bgColor is na the return will be gray.
Returns: A color that provides high contrast with the given background color.
發行說明
v5發行說明
v6Added:
brighten(c, value)
Proportionally adjusts the RGB values of a color. A value of positive (+) 100 will result in white. A value of negative (-) 100 will result in black.
Parameters:
c: The color to adjust.
value: The amount (-100 to +100) to adjust the color by. Values less than -100 or greater than +100 will be clamped.
Returns: The resultant color.
darken(c, value)
Proportionally adjusts the RGB values of a color. A value of positive (+) 100 will result in black. A value of negative (-) 100 will result in white.
Parameters:
c: The color to adjust.
value: The amount (-100 to +100) to adjust the color by. Values less than -100 or greater than +100 will be clamped.
Returns: The resultant color.
發行說明
v7 Fixes to brighten 發行說明
v8 Fixes to brighten發行說明
v9 Added extension syntax.Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。