|
From: Ethan A M. <sf...@us...> - 2014-03-07 20:24:41
|
On Friday, 07 March, 2014 12:05:27 Ethan A Merritt wrote:
> ere is one way to do it. This may not cover all the desired cases:
>
> gnuplot> argb(a,r,g,b) = sprintf("0x%.2x%.2x%.2x%.2x",a,r,g,b)
> gnuplot> print argb(0x78,0,0,0)
> 0x78000000
> gnuplot> print argb(0xff, 0, 255, 127.0)
> 0xff00ff7f
>
> Yes that produces a string rather than an integer, but the plotting commands
> are happy to take the string.
Correction. If you want to pass that directly to a plot command you
currently need to modify it to
gnuplot> argb(a,r,g,b) = sprintf("#%.2x%.2x%.2x%.2x",a,r,g,b)
The first form generates a valid hexadecimal constant but the
color code will only parse it that way if passed as a bare integer,
not in a string constant. So this works:
plot x lc rgb 0xff00ff7f
But this doesn't
plot x lc rgb "0xff00ff7f"
That's fixable.
Ethan
|