PINE LIBRARY
已更新 ColorExtension

Library "ColorExtension"
Color Extension methods.
hsl(hue, saturation, lightness, transparency) HSL color transform.
Parameters:
Returns: color
rgb_to_hsl(red, green, blue) Convert RGB to HSL color values
Parameters:
Returns: tuple with 3 float values, hue, saturation and lightness.
complement(primary) Complementary of selected color
Parameters:
Returns: color.
invert(primary) Inverts selected color.
Parameters:
Returns: color.
is_cool(base) Color is cool or warm.
Parameters:
Returns: bool.
temperature(base) Color temperature.
Parameters:
Returns: bool.
is_high_key(base) Color is high key (orange yellow green).
Parameters:
Returns: bool.
mix(base, mix, rate) Mix two colors together.
Parameters:
Returns: color.
analog(primary) Selects 2 near spectrum colors (H +/- 45).
Parameters:
Returns: tuple with 2 colors.
triadic(primary) Selects 2 far spectrum colors (H +/- 120).
Parameters:
Returns: tuple with 2 colors.
tetradic(primary) Uses primary and the complementary color, + 60º to form a rectangular pattern on the color wheel.
Parameters:
Returns: tuple with 3 colors.
square(primary) Uses primary and generate 3 equally spaced (90º) colors.
Parameters:
Returns: tuple with 3 colors.
Color Extension methods.
hsl(hue, saturation, lightness, transparency) HSL color transform.
Parameters:
- hue: float, hue color component, hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, 240 is blue.
- saturation: float, saturation color component, saturation is a percentage value, 0 means a shade of gray and 100 is the full color.
- lightness: float, lightness color component, Lightness is also a percentage; 0 is black, 100 is white.
- transparency: float, transparency color component, transparency is also a percentage; 0 is opaque, 100 is transparent.
Returns: color
rgb_to_hsl(red, green, blue) Convert RGB to HSL color values
Parameters:
- red: float, red color component.
- green: float, green color component.
- blue: float, blue color component.
Returns: tuple with 3 float values, hue, saturation and lightness.
complement(primary) Complementary of selected color
Parameters:
- primary: color, the primary
Returns: color.
invert(primary) Inverts selected color.
Parameters:
- primary: color, the primary.
Returns: color.
is_cool(base) Color is cool or warm.
Parameters:
- base: color, the color to check.
Returns: bool.
temperature(base) Color temperature.
Parameters:
- base: color, the color to check.
Returns: bool.
is_high_key(base) Color is high key (orange yellow green).
Parameters:
- base: color, the color to check.
Returns: bool.
mix(base, mix, rate) Mix two colors together.
Parameters:
- base: color, the base color.
- mix: color, the color to mix.
- rate: float, default=0.5, the rate of mixture, range within 0.0 and 1.0.
Returns: color.
analog(primary) Selects 2 near spectrum colors (H +/- 45).
Parameters:
- primary: color, the base color.
Returns: tuple with 2 colors.
triadic(primary) Selects 2 far spectrum colors (H +/- 120).
Parameters:
- primary: color, the base color.
Returns: tuple with 2 colors.
tetradic(primary) Uses primary and the complementary color, + 60º to form a rectangular pattern on the color wheel.
Parameters:
- primary: color, the base color.
Returns: tuple with 3 colors.
square(primary) Uses primary and generate 3 equally spaced (90º) colors.
Parameters:
- primary: color, the base color.
Returns: tuple with 3 colors.
發行說明
updated description.發行說明
added new functions:shift_hue(base, angle) Shift the hue/angle of the provided color.
Parameters:
- base: color, base color.
- angle: float, angle to shift the hue of the base color.
Returns: color.
saturate(base, rate) Saturate the provided color by a rate of the difference to its maximum.
Parameters:
- base: color, base color.
- rate: float, default=0.5, rate to saturate the base color (the higher the saturation of the color the less the effect).
Returns: color.
desaturate(base, rate) Desaturate the provided color by a rate of the difference to its minimum.
Parameters:
- base: color, base color.
- rate: float, default=0.5, rate to desaturate the base color (the lower the saturation of the color the less the effect).
Returns: color.
lighten(base, rate) lighten the provided color by a rate of the difference to its maximum.
Parameters:
- base: color, base color.
- rate: float, default=0.5, rate to lighten the base color (the higher the lightness of the color the less the effect).
Returns: color.
darken(base, rate) darken the provided color by a rate of the difference to its minimum.
Parameters:
- base: color, base color.
- rate: float, default=0.5, rate to darken the base color (the lower the lightness of the color the less the effect).
Returns: color.
發行說明
improved some code and added:color_to_hsl(base) Convert the provided color into HSL values.
Parameters:
- base: color, base color.
Returns: tuple with 3 floats.
發行說明
v5 Update to V6, minor code cleanup.發行說明
v5 corrected a minor issue.Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。