Visual
20 entries. What each one takes, what it returns, and a working example.
Opacity of the hex color (0-1; #rrggbbaa). Result: 0.5019607843
Returns the color's opacity as a number 0-1. If the color has no alpha channel (6-digit #rrggbb) or is invalid, it returns 1 (fully opaque).
Note
It is a color decomposer: it converts a hex color's alpha (opacity) byte to the 0-1 scale (e.g. 0x80 → 0.502). Where red/green/blue give channels, alpha gives opacity.
When to use
To numerically read how transparent a color is: to preserve/change opacity when rebuilding with rgb, or to make a decision against a threshold.
Not for
Not for the red/green/blue components — use red/green/blue. To produce a color use rgb.
c = "#2962ff80" plot(alpha(c), "Opacity")
The opacity of #2962ff80 (0x80 → ~0.502) is plotted as a flat line.
barcolor(color, offset?, display?)
Colors the candles. Single color or a color series via iff. offset: shifts the coloring N bars right(+)/left(-).
Returns nothing; colors the candle bodies with the given color.
Note
The color can be a series; with iff each candle takes its own color by condition. barcolor colors INSTANTANEOUSLY — each bar's color depends only on that bar's condition. To color a region continuously until the signal changes, use colorBySignal.
When to use
To show a condition directly on price by coloring the candles: up/down, above/below a trend filter, a volume threshold breach. It carries the signal into the candle color without opening a separate panel.
Not for
Not for holding the color across the whole region between signals — that forward-fill is colorBySignal. To color by strategy position (long/short/flat) use colorByPosition. To shade the background (not the candle) use bgcolor.
barcolor(iff(close > open, "#26a69a", "#ef5350"))
Up candles are colored green, down candles red.
barcolor(iff(close > sma(close,50), "#26a69a", "#787b86"))
Candles are green while price is above SMA50, gray while below.
bgcolor(color, offset?, display?)
Colors the bar background (market-state highlight). offset: shifts the coloring N bars right(+)/left(-).
Returns nothing; colors the bars' background (the full vertical stripe).
Note
The color can be a series; with iff you give a different color per bar by condition (or na → no shading). bgcolor paints the entire vertical bar stripe — it is independent of price level. Passing na in the second iff branch shades only the bars that meet the condition — keeping the chart free of needless color.
When to use
To highlight market state and condition regions: overbought/oversold windows, trend direction, session hours, or bars where a filter is active. It shades the background without touching price.
Not for
Not for a single horizontal level (hline), not for shading BETWEEN two series (fill), not for coloring the candles themselves (barcolor). Prefer translucency; an opaque color hides the candles.
Tip
Passing na in the second iff branch shades only the bars that meet the condition — keeping the chart free of needless color.
The color can be a series; with iff you give a different color per bar by condition (or na → no shading). bgcolor paints the entire vertical bar stripe — it is independent of price level.
Passing na in the second iff branch shades only the bars that meet the condition — keeping the chart free of needless color.
bgcolor(iff(close > open, "#26a69a22", "#ef535022"))
Up bars get a translucent green background, down bars a translucent red one.
bgcolor(iff(rsi(close,14) > 70, "#ef535033", na))
Only RSI>70 (overbought) bars get a red background; other bars stay unshaded (na).
Blue channel of the hex color (0-255). Result: 154
Returns the color's blue channel as a number 0-255 (invalid color → 0).
Note
It is a color decomposer: it extracts the blue component from a hex color. Together with red/green/alpha it is used to take a color apart and rebuild it with rgb.
When to use
To process a color channel by channel: to change opacity and reassemble, to compute a gradient between two colors, or to adjust a shade conditionally.
Not for
Not for producing a color (rgb). To read opacity use alpha.
base = "#2962ff" channel = blue(base) plot(channel, "Blue Channel")
The blue channel (255) of #2962ff is plotted as a flat line.
colorByPosition(long?, short?, flat?)
Colors candles by strategy position: long / short / flat.
Returns nothing; after the backtest it colors the candles by the strategy position state.
Note
It requires a strategy (a position must be opened with enterLong/enterShort). Colors are applied after the backtest runs, by looking at each bar's position: long>0 → long color, short<0 → short color, otherwise flat. The actual position state, not a condition, decides.
When to use
To see directly in the candle color when the strategy is in the market (long/short) and when it is flat. It is the fastest way to visually audit the positions the backtest held.
Not for
It does nothing without a strategy (positions) — to just color a condition use barcolor/colorBySignal. For signal-based region coloring (without opening positions) use colorBySignal.
fast = sma(close, 5) slow = sma(close, 20) enterLong(crossover(fast, slow)) enterShort(crossunder(fast, slow)) colorByPosition("#26a69a", "#ef5350", "#787b86")
Candles are green while long, red while short, gray while flat.
colorBySignal(longSignal, shortSignal, longColor?, shortColor?, flatColor?)
Colors candles by signal state: long / short / flat.
Returns nothing; colors candle regions by forward-filling the signal state.
Note
It takes two signals and holds STATE: on longSignal the region turns green and stays so until shortSignal arrives; on shortSignal it turns red. Before the first signal it uses the flat color. Where barcolor(iff(...)) colors each bar instantaneously and looks speckled, this produces continuous green/red blocks.
When to use
To show a buy/sell signal pair as uninterrupted regions: it colors not just the signal bar but every bar after it in that direction. More readable than barcolor for seeing trend and market state blocks cleanly.
Not for
Not for instantaneous (signal-bar-only) coloring — that is barcolor. To color by strategy position (actual long/short) use colorByPosition; colorBySignal works from raw signals without opening positions.
colorBySignal(crossover(close, sma(close,20)), crossunder(close, sma(close,20)))
The region turns green when price crosses above SMA20 and red when it crosses below; gray until the first signal.
buy = crossover(close, sma(close,20)) sell = crossunder(close, sma(close,20)) colorBySignal(buy, sell, "#00c853", "#d50000", "#9e9e9e")
The same signals are colored as continuous blocks with custom green/red/gray tones.
Fills the area between two things — a/b can be a plot series, a constant, or an hline(). E.g. between Bollinger bands or two horizontal levels: fill(hline(30), hline(70),...).
Returns nothing; shades the area between the a and b series with color.
Note
Both edges may be series; a constant or an hline() becomes a fixed horizontal level on every bar. A fill between two hline()s (fill(hline(30), hline(70),...)) shades fixed regions like an overbought/oversold band. The fill covers the vertical gap between a and b; the area is shaded correctly even where the edges cross. You usually plot/hline both edges as well to make the band visible. Add alpha to the color (e.g. #2196f322 — the trailing 22 is opacity) so the candles under the fill stay visible.
When to use
To highlight the space between two lines: the inside of an envelope/channel, the gap between two moving averages, or the body of a band (upper/lower). It visually emphasizes the trend widening and narrowing.
Not for
Not for drawing a single line — use plot. If you want to color the bar background (the whole vertical stripe, independent of price) use bgcolor; fill only shades BETWEEN two series.
Tip
Add alpha to the color (e.g. #2196f322 — the trailing 22 is opacity) so the candles under the fill stay visible.
Both edges may be series; a constant number is broadcast to every bar. The fill covers the vertical gap between a and b; the area is shaded correctly even where the edges cross. You usually plot both edges as well to make the band visible.
Add alpha to the color (e.g. #2196f322 — the trailing 22 is opacity) so the candles under the fill stay visible.
fast = ema(close, 12) slow = ema(close, 26) plot(fast) plot(slow) fill(fast, slow, "#2196f3")
The area between EMA12 and EMA26 is shaded blue; the band widens as the two averages spread apart.
b = bb(close, 20, 2) plot(b.upper) plot(b.lower) fill(b.upper, b.lower, "#2962ff22")
The body between the Bollinger upper and lower bands fills with translucent blue.
Green channel of the hex color (0-255). Result: 166
Returns the color's green channel as a number 0-255 (invalid color → 0).
Note
It is a color decomposer: it extracts the green component from a hex color. Together with red/blue/alpha it is used to take a color apart and rebuild it with rgb.
When to use
To process a color channel by channel: to change opacity and reassemble, to compute a gradient between two colors, or to adjust a shade conditionally.
Not for
Not for producing a color (rgb). To read opacity use alpha.
base = "#26a69a" channel = green(base) plot(channel, "Green Channel")
The green channel (166) of #26a69a is plotted as a flat line.
hline(price, title?, color?, style?, width?, display?)
Horizontal fixed level line (e.g. overbought 70).
Returns nothing; draws a horizontal constant level on the price panel.
Note
The level is a single constant number — it does not change bar to bar. If you pass an indicator series (e.g. sma(close,50)) only its last-bar value is used to draw a flat line at that height; for a moving line use plot. For multiple thresholds on the same chart call hline several times (e.g. 70 and 30); each becomes an independent level.
When to use
To mark fixed support/resistance, targets, stops, or threshold levels like 70/30. Ideal for showing overbought/oversold bands.
Not for
Not for drawing a value that moves bar to bar (a moving average, a band) — use plot for that. If you want to shade a background region instead of a price level, use bgcolor.
Tip
For multiple thresholds on the same chart call hline several times (e.g. 70 and 30); each becomes an independent level.
The level is a single constant number — it does not change bar to bar. If you pass an indicator series (e.g. sma(close,50)) only its last-bar value is used to draw a flat line at that height; for a moving line use plot.
For multiple thresholds on the same chart call hline several times (e.g. 70 and 30); each becomes an independent level.
hline(70, "Overbought", "#ef5350")
Red dashed horizontal line at level 70, labeled `Aşırı Alım`.
hline(30, "Oversold", "#26a69a", "dotted", 2)
Green dotted horizontal line at level 30, 2px thick.
location.abovebar / belowbar / top / bottom / absolute / price
Placement names for plotshape/plotchar (dot access). location.abovebar is identical to "abovebar".
plotshape(close > open, style=shape.circle, location=location.belowbar)
Draws a circle BELOW every bar that closes above its open; without a location the shape sits at the bar's own level.
mark(condition, style?, location?, color?, text?, size?)
Draws a mark on bars where condition is true.
Returns nothing; stamps a mark on bars where the condition is true.
Note
condition is a series; one mark is drawn per true bar. It is a compact helper for quickly flagging signals — location and size are adjustable, but it lacks the finer controls (offset/textcolor) of plotshape.
When to use
To quickly flag buy/sell bars or bars where a condition fires. It is the first choice when you want signal points visible with minimal code.
Not for
Not for long/free text or a boxed label — use label. If you need to fine-tune the exact position (offset) or text color separately, prefer plotshape/plotchar. Do not tie it to a condition true on every bar; the marks pile up.
mark(crossover(close, sma(close,20)), "triangleup", "belowbar", "#26a69a", "AL")
Green up-triangle with 'AL' text below the bar where price crosses above SMA20.
mark(rsi(close,14) > 70, "circle", "abovebar", "#ef5350", "", "small")
Small red circle above the bar on RSI>70 bars.
plot(series, title?, color?, pane?, style?, linewidth?, linestyle?, offset?, display?, trackprice?, histbase?, axisLabel?)
Plots a series on the chart. style: line/stepline/histogram/columns/area/circles/cross (default line) — all 7 fully render on both the price pane and sub-panes (⚠ one limit: combined with a non-zero offset on the price pane it still draws as a line, with a warning). linewidth: 1-4. linestyle: solid/dashed/dotted. offset: shifts the line N bars right(+)/left(-) (visual only; the calculation series is unchanged). series must be numeric (passing text/string raises a clear error). `trackprice` draws a dotted horizontal line at the series last value. `histbase` sets the baseline for histogram/columns styles (0 when omitted). `axisLabel` toggles the price-axis badge (on by default).
Returns nothing; it draws the series onto the chart.
Note
Colors are hex codes; see the Colors section for ready-made options.
When to use
Use plot for a continuous line. To mark only the signal bars, write plot(iff(signal, price, na),...) — na bars are skipped, leaving gaps between the drawn points. When you need a discrete shape or arrow, prefer plotshape/plotchar/plotarrow.
Limits
Drawing many separate lines clutters the chart and makes it harder to read. Plotting a series on a very different scale from price (say RSI) on the price panel can flatten the candles; such series read better in a separate lower panel.
Not for
If you only want a discrete mark on certain bars, plot is the wrong tool — reach for plotshape, plotchar or plotarrow instead. For a fixed summary in the corner use tableNew, and for free text tied to a bar use label. If you are computing a value you never intend to draw, do not call plot at all; keep the value in a variable.
plot(sma(close,20), "SMA20", "#2962ff")
Blue SMA20 line on the price pane.
plot(iff(crossover(close,sma(close,10)), low, na), "AL", "#26a69a")
A green dot at the low level only on cross-above bars; other bars empty (na).
plot(volume, "Volume", style="histogram", histbase=0) // a horizontal line at the last value, with the axis badge off: plot(sma(close, 20), "SMA20", trackprice=true, axisLabel=false)
Draws volume as zero-based columns and the average with a horizontal line at its last value; the axis badge is off.
plotarrow(series, title?, colorup?, colordown?, offset?, minheight?, maxheight?, display?)
Draws arrows by series value: >0 up, <0 down, 0/na none. Height scales with |value| (minheight..maxheight px). colorup/colordown set arrow colors.
Returns nothing; it draws arrows according to the signed series.
Note
The arrow height is proportional to |value| (clipped to minheight..maxheight); it visualizes the magnitude.
When to use
To show not just direction but the strength or magnitude of a signal (momentum, a histogram). Use plotshape for a fixed-size mark.
Limits
Only the sign sets the direction (up/down); the absolute size of the value is reflected in the arrow's height. Bars with 0 or na are left empty.
Not for
Not for a fixed-size mark — use plotshape. For a plain on/off state the varying height of plotarrow adds nothing; plotshape or plotchar is clearer. Use label for free text and tableNew for a fixed summary.
plotarrow(close - open)
Up arrow on bullish bars, down arrow on bearish bars; length proportional to body size.
plotarrow(macd(close).hist)
Up/down arrows based on the MACD histogram sign.
plotbar(open, high, low, close, title?, color?, editable?, show_last?, display?, format?, precision?, force_overlay?)
Plots a custom OHLC bar series (no body — vertical high-low line plus left open/right close ticks, single color).
Returns nothing; draws one OHLC bar per bar on the price chart.
Note
Unlike plotcandle: there is NO body (filled rectangle) — just a vertical high-low line with a short tick on the left for open and on the right for close. The whole bar is a SINGLE color (no separate body/wick/border colors like plotcandle).
Not for
If you want a filled candle body, use plotcandle instead. For a single continuous line series, plot is enough.
plotbar(open, high, low, close, color=close>=open?"#26a69a":"#ef5350")
Green OHLC bar when close is above open, red when below.
plotcandle(open, high, low, close, title?, color?, wickcolor?, editable?, show_last?, bordercolor?, display?, format?, precision?, force_overlay?)
Plots a custom candle series.
Returns nothing; it draws a custom candle series from the given OHLC.
Note
For drawing your own OHLC (e.g. Heikin-Ashi, rescaled) or conditionally colored candles. The color can be conditioned on a series.
When to use
For a derived or conditionally colored candle view (barcolor only tints one color, whereas plotcandle draws the whole OHLC body).
Limits
All four OHLC series are required; no candle is drawn on bars with na. It overlays the main price candles.
Not for
If coloring the candles a single color is enough, plotcandle is overkill — use barcolor. For one line use plot, and for a discrete mark plotshape fits better. You cannot draw a candle without all four OHLC series; do not call it when data is missing.
plotcandle(open, high, low, close)
OHLC candles in the default single-blue color.
plotcandle(open, high, low, close, color=close>=open?"#26a69a":"#ef5350", wickcolor="#787b86")
Green body on rise / red body on fall, gray wick.
plotchar(series, title?, char?, location?, color?, offset?, text?, textcolor?, size?, display?)
Draws a single CHARACTER (glyph) on bars where series is true. char: the mark (default ★). location: abovebar/belowbar/top/bottom/absolute.
Returns nothing; it stamps a character onto the bars where the condition holds.
Note
Like plotshape, but instead of a fixed shape it draws the character/glyph you choose. The collision-avoidance rule in text works the same as plotshape.
When to use
When you need a symbol plotshape does not include (such as ▲ ✓ ✗ $). Use label for free multi-character text.
Limits
A single character or glyph; not suited to long text (use label). It gets just as crowded as plotshape when overused.
Not for
Not for long or multi-word text; it draws a single character or glyph, so use label for anything more than one letter. For a fixed summary panel prefer tableNew. If you need to show a value's magnitude, plotchar does not vary in size — switch to plotarrow.
plotchar(close > open, char="B", location="belowbar", color="#26a69a")
Green 'B' below green (bullish) bars.
plotchar(crossunder(close, ema(close,20)), char="x", location="abovebar")
'x' above the bar on EMA20 cross-below bars.
plotshape(series, title?, style?, location?, color?, offset?, text?, textcolor?, size?, display?)
Draws a SHAPE on bars where series is true (≠0/na). style: arrowup/arrowdown/triangleup/triangledown/circle/square/diamond/cross/xcross/flag/labelup/labeldown. location: abovebar/belowbar/top/bottom/absolute. size: tiny/small/normal/large/huge (shape icon size, default normal).
Returns nothing; it stamps a shape onto the chart on the bars where the condition holds.
Note
series is a boolean/series; a shape is drawn on every true bar. location positions the shape relative to the bar. Adding in text (at the END of the text for abovebar, at the START for belowbar) pushes the label away from the bar — use this to avoid overlapping another label on the same bar (e.g. the automatic buy/sell marker). If you need several marks on the same bar, use different location values (abovebar/belowbar) to keep them from overlapping.
When to use
For discrete buy/sell or condition marks. Use label for free text, plotchar for a single symbol or glyph, and plotarrow to show magnitude.
Limits
Only the supported shape names work; you cannot load a custom icon. If the condition is true too often the chart gets crowded — reserve the mark for infrequent conditions.
Not for
Not for showing free-form or long text — use label for that. If you need a symbol plotshape does not offer (▲ ✓ ✗ $), reach for plotchar, and to convey a signal's magnitude as height use plotarrow. Do not tie it to a condition that is true on every bar; the shapes pile up and the chart becomes unreadable.
Tip
If you need several marks on the same bar, use different location values (abovebar/belowbar) to keep them from overlapping.
series is a boolean/series; a shape is drawn on every true bar. location positions the shape relative to the bar. Adding in text (at the END of the text for abovebar, at the START for belowbar) pushes the label away from the bar — use this to avoid overlapping another label on the same bar (e.g. the automatic buy/sell marker).
If you need several marks on the same bar, use different location values (abovebar/belowbar) to keep them from overlapping.
plotshape(crossover(close, sma(close,10)), style="triangleup", location="belowbar", color="#26a69a")
Green up-triangle below the bar on SMA10 cross-above bars.
plotshape(rsi(close,14) > 70, style="arrowdown", location="abovebar", color="#ef5350", size="small")
Small red down-arrow above the bar on RSI>70 bars.
Red channel of the hex color (0-255). Result: 38
Returns the color's red channel as a number 0-255 (invalid color → 0).
Note
It is a color decomposer: it extracts the red component from a hex color. Together with green/blue/alpha it is used to take a color apart and rebuild it with rgb.
When to use
To process a color channel by channel: to change its opacity and reassemble, to compute a transition (gradient) between two colors, or to adjust a shade conditionally.
Not for
Not for producing a color (that is rgb's job). To read a color's opacity use alpha.
base = "#2962ff" fade = rgb(red(base), green(base), blue(base), 0.2) bgcolor(fade)
The channels of #2962ff are read and reassembled at 20% opacity; the background becomes faint blue (#2962ff33).
RGB (0-255) → '#rrggbbaa' (opacity 0-1). Result: #26a69a80
Returns a hex color string in #rrggbbaa form (opacity is mapped to a 0-255 alpha byte).
Note
It is a color builder: it assembles one hex color from three channels + opacity. opaklik is on a 0-1 scale and is rounded to a 0-255 alpha byte (e.g. 0.15 → 0x26). You can feed the result anywhere a color is expected — plot/barcolor/bgcolor/fill.
When to use
To build a color numerically instead of writing a fixed hex: to set opacity programmatically, to decompose with red/green/blue and reassemble, or to compute a color from a value.
Not for
Not needed for a fixed known color — just write the hex ("#26a69a"). If you only want to add opacity, color(hex, alpha) is shorter.
bgcolor(rgb(38, 166, 154, 0.15))
A 15%-opacity green (#26a69a26) background applied to all bars.
barcolor(rgb(239, 83, 80))
All candles colored with fully opaque red (#ef5350ff).
shape.arrowup / arrowdown / triangleup / triangledown / circle / square / diamond / cross / xcross / flag / labelup / labeldown
Shape names for plotshape (dot access). shape.circle is identical to "circle"; the dotted form is preferred for readability. (plotchar takes a character, not a shape, so it does not apply there.)
plotshape(close > open, style=shape.triangleup)
Puts an up-pointing triangle on every bar that closes above its open; the shape type is picked from this list.
Gives the blue channel of a colour as a number between 0 and 255. Used with `colorR` and `colorG` to rebuild a colour.
The blue channel of the color (0-255). Empty if the color cannot be parsed.
Note
colorR/colorG/colorB split a color into its channels; rgb(r,g,b,opacity) rebuilds it. Typical use: reproduce the same hue at a different opacity.
When to use
When you want to keep the user-picked color but change only its transparency.
k = colorB("#089981")
Takes the blue component of the given colour as a number between 0 and 255; it draws nothing and keeps the value in a variable.
colorFromHsb(hue, saturation, brightness, transparency?)
Builds a color from hue/saturation/brightness. hue 0-360 (wraps), saturation and brightness 0-1, opacity 0-1 (default 1) - same scale as rgb()/color().
Note
Our opacity scale is 0-1 (consistent with rgb()/color()). colorToInt/colorFromInt round-trip exactly; use them to store or compare colors numerically.
When to use
When generating colors programmatically (hue shifting) or storing them numerically.
c = colorFromHsb(200, 0.8, 1)
Builds a colour from hue, saturation and brightness; these values produce a light blue.
Converts a 0xAARRGGBB integer back to a color - the inverse of colorToInt (the round trip is exact).
Note
Our opacity scale is 0-1 (consistent with rgb()/color()). colorToInt/colorFromInt round-trip exactly; use them to store or compare colors numerically.
When to use
When generating colors programmatically (hue shifting) or storing them numerically.
c = colorFromInt(4294901760)
Converts a colour stored as a number back into a colour; useful when colours arrive as numbers from elsewhere.
Gives the green channel of a colour as a number between 0 and 255. Used with `colorR` and `colorB` to rebuild a colour.
The green channel of the color (0-255). Empty if the color cannot be parsed.
Note
colorR/colorG/colorB split a color into its channels; rgb(r,g,b,opacity) rebuilds it. Typical use: reproduce the same hue at a different opacity.
When to use
When you want to keep the user-picked color but change only its transparency.
k = colorG("#089981")
Takes the green component of the given colour as a number between 0 and 255.
Makes a color TRANSPARENT. `transparency` 0 = fully opaque, 100 = fully invisible. The most used helper for fills and zones: `box.new(..., bgcolor = colorNew("#2962ff", 85))` gives a blue box that does not hide the candles behind it.
A color with alpha baked in (`#rrggbbaa`).
Note
The most used helper for fills and zones. Without transparency the color stays opaque and hides the candles behind the box — the usual cause of 'I drew a zone but the candles vanished'.
b = boxNew(bar_index-5, high, bar_index, low, bgcolor = colorNew("#2962ff", 85))
Draws a box over the last five bars in the chosen colour; the colour is given together with its transparency.
Gives the red channel of a colour as a number between 0 and 255. Used together with `colorG` and `colorB` to take a colour apart and rebuild it with a different transparency. Returns empty when the colour cannot be read.
The red channel of the color (0-255). Empty if the color cannot be parsed.
Note
colorR/colorG/colorB split a color into its channels; rgb(r,g,b,opacity) rebuilds it. Typical use: reproduce the same hue at a different opacity.
When to use
When you want to keep the user-picked color but change only its transparency.
k = colorR("#089981")
Takes the red component of the given colour as a number between 0 and 255.
colorRgb(r, g, b, transparency?)
Builds a color from red/green/blue channels (0-255). Transparency is 0-100 (0 fully opaque, 100 invisible); defaults to 0. Note: rgb() uses a 0-1 opacity scale instead.
The color built from the channels.
Note
The transparency scale is 0-100, whereas rgb() uses a 0-1 opacity scale - do not mix them. Use it with colorR/colorG/colorB to split a color and rebuild it at a different transparency.
When to use
When computing box/label fill transparency programmatically.
c = colorRgb(8, 153, 129, 60)
Builds a colour from red, green, blue and transparency values; the larger the last number, the more transparent the colour.
Returns a color's transparency percentage (0-100). Colors without alpha return 0 (opaque). Use it to read back the transparency set with `color.new`.
Transparency percent 0-100; 0 when the color has no alpha.
Note
Reads back the transparency set with `color.new`.
t = colorT(colorNew("#2962ff", 85))
Takes a colour's transparency as a number between 0 and 100; 0 is fully opaque and 100 fully invisible.
Packs a color into a single integer: 0xAARRGGBB (alpha in the highest byte). Unrecognized color -> empty.
Note
Our opacity scale is 0-1 (consistent with rgb()/color()). colorToInt/colorFromInt round-trip exactly; use them to store or compare colors numerically.
When to use
When generating colors programmatically (hue shifting) or storing them numerically.
n = colorToInt("#ff0000ff")
Converts a colour into a single number; used when colours need to be stored or compared as numbers.