JScript Operation - RealWorld forums

Log-in or register.

JScript Operation

Getting the Active Primary Color
on August 7th 2016

Using RW API, how can I get the foreground color?

I found the mention of the Context object, but I guess I need a code example ... or more of a hint.

on August 7th 2016

That is kind of complicated, because the concept of a foreground/background colors was abandoned in later versions of RW apps in favor of a "fill style" and eventually "outline style". Some fill styles use no colors, other use multiple, so it is unclear what a foreground color is.

That said, you can access the state of the "SOLID" fill style in a raster editor like this:


And you may get for example this result as a string:


The numbers behind the : represent RGBA values of the current solid fill color in ranges 0-1.

Vector editor has a different active fill style, which you can access via:

Page views: 632       Posts: 2      
What about ICL files?
Select background
Vista & Win 7 icons