Script:
~addons/finance/finexec/toolbox/color.ijs
Contrinutor: William Szuch
Updated: 2022 6 26
Depend: ~addons/graphics/viewmat/viewmat.ijs
Definitions: loaded to locale base
Status: done
Script source:
color.ijs
Show the color for rgb/hexadecimal and number
formats.
rgb triplet eg: 100 50 150
hexadecimal number as text eg: ‘aaaaaa’
number < 256^3
Convert between number/hexadecimal and RGB
Useful for selecting colors for web pages.
View: color
table 256
View: color
table
See folder: ~addons/graphics/color
Definitions
hexcolor (monad)
Form: explicit
Show hexadecimal color
Syntax
hexcolor(H)
H = hexadecimal number as text
Example
hexcolor('aaaaaa')
hexcolor('000000')
hextonumber (monad)
Form: tacit
Convert a hexadecimal number to a number
Syntax
hextonumber(H)
H = hexadecimal number as text ie: 'asd'
Example
hextonumber('aaaaaa')
11184810
hextonumber('000000')
0
hextonumber('asd')
2829
hextorgb (monad)
Form: tacit
Convert a hexadecimal number to rgb color triplet.
Syntax
hextorgb(H)
H = hexadecimal number as text
Example
hextorgb('aaaaaa')
170 170 170
hextorgb('000000')
0 0 0
numbercolor (monad)
Form: explicit
Show number color
Syntax
numbercolor(N)
N = integer number < _1+256^3
Example
numbercolor(0)
numbercolor(2000000)
numbertohex (monad)
Form: tacit
Convert a number to hexadecimal text number.
Syntax
numbertohex(N)
N = integer <= 256^3
Example
numbertohex(100)
000064
numbertohex(0)
000000
numbertohex(_1+ 256^3)
ffffff
numbertorgb (monad)
Form: tacit
Convert number to rgb color triplet.
Syntax
numbertorgb(N)
N = number in the range (0,-1+256^3)
Example
numbertorgb(6579300)
100 100 100
numbertorgb(0)
0 0 0
numbertorgb(_1+256^3)
255 255 255
rgbcolor (monad)
Form: explicit
Show rgb color triplet.
Syntax
rgbcolor(R,G,B)
R = red : integer 0 to 255
G = green : integer 0 to 255
B = blue : integer 0 to 255
Example
rgbcolor(100 100 100)
rgbcolor(255 0 0)
rgbtonumber (monad)
Form: tacit
Convert rgb color triplet to a number.
Syntax
rgbtonumber(N)
N = rgb triplet in the range (0 0 0)...(255 255 255)
Example
rgbtonumber(100 100 100)
6579300
rgbtonumber(0 0 0)
0