คัดสรรโดยบรรณาธิการPINE LIBRARY
HSV and HSL gradient Tools ( Built-in Drop-in replacement )

Library "hsvColor"
HSV and HSL Gradient Tool Alternatives and helpers. Demo'd is built-in in the middle with HSL/HSV gradients on top/bottom
TODO: Solve for #000000 issue
rgbhsv(_col)
RGB Color to HSV Values
Parameters:
_col: Color input (#abc012 or color.name or color.rgb(0,0,0,0))
Returns: [h,s,v,a] values
rgbhsv(_r, _g, _b, _t)
RGB Color to HSV Values
Parameters:
_r: Red 0 - 255
_g: Green 0 - 255
_b: Blue 0 - 255
_t: Transp 0 - 100
Returns: [h,s,v,a] values
hsv(_h, _s, _v, _a)
HSV colors, Auto fix if past boundaries
Parameters:
_h: Hue Input (-360 - 360) or further
_s: Saturation 0.- 1.
_v: Value 0.- 1.
_a: Alpha 0.- 1.
Returns: Color output
hue(_col)
returns 0-359 hue on color wheel
Parameters:
_col:
Returns: 360 degree hue value
hsv_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
hsl_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
HSV and HSL Gradient Tool Alternatives and helpers. Demo'd is built-in in the middle with HSL/HSV gradients on top/bottom
TODO: Solve for #000000 issue
rgbhsv(_col)
RGB Color to HSV Values
Parameters:
_col: Color input (#abc012 or color.name or color.rgb(0,0,0,0))
Returns: [h,s,v,a] values
rgbhsv(_r, _g, _b, _t)
RGB Color to HSV Values
Parameters:
_r: Red 0 - 255
_g: Green 0 - 255
_b: Blue 0 - 255
_t: Transp 0 - 100
Returns: [h,s,v,a] values
hsv(_h, _s, _v, _a)
HSV colors, Auto fix if past boundaries
Parameters:
_h: Hue Input (-360 - 360) or further
_s: Saturation 0.- 1.
_v: Value 0.- 1.
_a: Alpha 0.- 1.
Returns: Color output
hue(_col)
returns 0-359 hue on color wheel
Parameters:
_col:
Returns: 360 degree hue value
hsv_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
hsl_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
เอกสารเผยแพร่
v2hsl/inv Upgrades..
Added:
rgbhsl(_col)
HSL vals from rgb col in
Parameters:
_col: The Color
Returns: HSLA tuple out
hsl(h, s, l)
HLS input to color output
Parameters:
h: hue
s: saturation
l: lightness
Returns: The RGB Color
relativeluminance(color)
Parameters:
color: (hex,rgb,color.___)
return float
hsvInvert(_color)
Invert a color with hsv method (original experimental)
Parameters:
_color: color input
Returns: inverted color
hslInvert(_color)
Invert a color with hsl method (original experimental)
Parameters:
_color: color input
Returns: inverted color
เอกสารเผยแพร่
new image for demo.เอกสารเผยแพร่
v4UPDATED
Rewrote HSL chain and fixed problems with out of limit values
should be bulletproofed now and is faster than it was
thanks @NeonTL8 for notifying me of the problem.
Library "hsvColor"
HSV and HSL Gradient Tool Alternatives
rgbhsv(_col)
RGB Color to HSV Values
Parameters:
_col: Color input (#abc012 or color.name or color.rgb(0,0,0,0))
Returns: [h,s,v,a] values
rgbhsv(_r, _g, _b, _t)
RGB Color to HSV Values
Parameters:
_r: Red 0 - 255
_g: Green 0 - 255
_b: Blue 0 - 255
_t: Transp 0 - 100
Returns: [h,s,v,a] values
hsv(_h, _s, _v, _a)
HSV colors, Auto fix if past boundaries
Parameters:
_h: Hue Input (-360 - 360) or further
_s: Saturation 0.- 1.
_v: Value 0.- 1.
_a: Alpha 0.- 1.
Returns: Color output
hue(_col, _rotate)
returns 0-359 hue on color wheel
Parameters:
_col:
_rotate: Turn output by N degrees (+/-)
Returns: 360 degree hue value
rgbhsl(_col)
HSL vals from rgb col in
Parameters:
_col: The Color
Returns: HSLA tuple out
hsl(h, s, l)
HLS input to color output
Parameters:
h: hue
s: saturation
l: lightness
Returns: The RGB Color
relativeluminance(color)
Parameters:
color: (hex,rgb,color.___)
Returns: float
hsvInvert(_color)
Invert a color with hsv method (original experimental)
Parameters:
_color: color input
Returns: inverted color
hslInvert(_color)
Invert a color with hsl method (original experimental)
Parameters:
_color: color input
Returns: inverted color
hsv_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
hsl_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal: Control signal
_startVal: start color limit
_endVal: end color limit
_startCol: start color
_endCol: end color
Returns: HSV calculated gradient
เอกสารเผยแพร่
v5upgrades, bugfixes
Added:
hslimit(_h, _s, _vl, _a)
Parameters:
_h: h input to limit signals before using color.
_s: s input to limit signals before using color.
_vl: v input to limit signals before using color.
_a: a input to limit signals before using color.
bright(col)
Calculate Brightness Level of color.
Parameters:
col: (hex,rgb,color.___)
Returns: float brightness level
tripswitch(_color, _th, _colora, _colorb)
Switch between colors based on Color Brightness
Parameters:
_color: color control signal
_th: threshold for switch between colors
_colora: if below threshold (default white)
_colorb: if above threshold (default black)
Returns: Contrasting color switched by input control color
เอกสารเผยแพร่
v6Bugs Squished on out-of-boundaries input values.
เอกสารเผยแพร่
v7For those interested in the color math, renamed all variables.
minified version available if requested/required
Also moved gradient calc to function from calc library,
on 0 distance between start and end it will default to first color.
i suggest iff you want to maintain on cross, use this:
abbv versio:
var _col
....
_col := switch
_start == _end => _col
=> h.....(gradient here w/ start and end)
Have an indicator you wish to style? send me a message :)
เอกสารเผยแพร่
v8Added two Helpful tools for creating multileveled colors
Current (nov 2022) Demo image is 100% original non-standard indicators, an same script with different sources and parameters..
built minimal using these two new tools, and 8 fills with 9colors each layer fades to a gradient of the last.
เอกสารเผยแพร่
v8เอกสารเผยแพร่
v10fixed bug on crossing end of gradient value and beginning value which caused hue glitch.
thanks @NeonTL8
เอกสารเผยแพร่
v14Sorry! accidental wrong version published ..
upgrades and nitpick fixes (0 hue transp cols)
เอกสารเผยแพร่
v15for found bug on pinned values on gradients when past limits and saturation is 0 on one and full on other.
เอกสารเผยแพร่
v16Faster. Way faster.
เอกสารเผยแพร่
v17Optimized a bunch, Fast as i can get it.
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน