Returns the blue channel of a color as a number from 0 to 255.
color.b reads the blue part of a color. Pure blue gives 255 and black gives 0.
Use it with color.r and color.g to compare colors or to build a darker or lighter variant through color.rgb.
Syntax
color.b(color: series color) -> series float
color.b(color: const color) -> const float
color.b(color: input color) -> input float
color.b(color: simple color) -> simple floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| color | const/ | required | The color to take the blue part from. na gives na. |
Returns
const/input/simple/series float: the blue value from 0 to 255; na if the color is na.
Remarks
- Hex colors such as #3355FF give the same channels you wrote in the code.
Example
//@version=6
indicator("Blue channel")
plot(color.b(#3355FF), "Blue", color = color.blue)
plot(color.r(#3355FF), "Red", color = color.red)See also
Runs on Sidechair