The quest for the 'addlayer' with a green color

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3417
Joined: Wed Sep 27, 2017 4:17 pm

The quest for the 'addlayer' with a green color

Post by CVH » Tue Sep 15, 2020 9:43 am

Hello,
it took me a half day to get the layer colors right.

Simple API addlayer() uses a colorName, addshape() uses a New Rcolor().

Added a layer with addlayer using "green" and I got dark green ... (0,128,0)
With "dark green" I got back even darker green ... (0,100,0)

Went through the whole RColor class, the GitHub masters and the forum back an forth ...
Collected these names from the 3 sources: "black" , "white" , "red" , "darkBlue"
I know "magenta" and "yellow" works too.
Found 2 or 3 lists depending on how deep you dig. (.js||.cpp||.h||*.*)
Tried the only other 'green' name I found: "l_green" and I got a pale green.

I just wanted the most standard QCAD (bright) green.

I queried that color with a script and I get "Green" (.getName()) "#00ff00" (.Name())
Capital "G" ... ok
Tried "Green" what offcourse gave back the same dark green ... (0,128,0) :roll:

Ended up with a list of the standard colors.
I'll start using these instead ...
#ff0000 - #00ff00 - #0000ff - #00ffff - #ff00ff - #ffff00 - #ff7f00
#800000 - #008000 - #000080 - #008080 - #800080 - #808000
#000000 - #a0a0a4 - #c0c0c0 - #ffffff

I can't list the names because of the green issue ...
I would not know how to call "#00ff00".
Simply "green" it is not. :wink:

Finally: addlayer( "MyLayer", "#00ff00", "CONTINUOUS", RLineweight.Weight013)
gave me a layer in standard green.

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: The quest for the 'addlayer' with a green color

Post by andrew » Thu Sep 17, 2020 6:51 am

The Qt doc refers to the SVG doc for supported color names:
https://www.w3.org/TR/SVG11/types.html#ColorKeywords

So that might be "lime".

RColor::getName should only be used to display the color name to the user. It's localized and does not match the table above.

For a localization neutral name use RColor::name() (QColor::name()) instead.

CVH
Premier Member
Posts: 3417
Joined: Wed Sep 27, 2017 4:17 pm

Re: The quest for the 'addlayer' with a green color

Post by CVH » Thu Sep 17, 2020 8:34 am

Never would be able to come up with that.
Surely not the link with SVG colors.
Using the 'RLB' color index over 'RGB' (with L from 'lime' and not G from 'green') :lol:

Of course, as a man I am less gifted and have much fewer cones in my retina, so I looked up the color 'Lime'.
It still looks 'lime green' to me:
  • Lime (color hex code #BFFF00) is a pure spectral color at approximately 564 nanometers.
The lower one reads through: https://en.wikipedia.org/wiki/Lime_(color)
The lesser it has something to do with the color 'lime green'.
I read further that 'gray' is even worse ...

I will stick to a "#ff0000" line entity on a "#a0a0a4" layer inside a "#0000ff" polyline entity beside a "#00ff00" circle. :lol:

Should I revoke all my references to the 'green' color in all my post?

Regards,
CVH

Post Reply

Return to “Chat”