Comparing RColor

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
Shutterstock
Active Member
Posts: 29
Joined: Wed Jun 14, 2023 4:02 pm

Comparing RColor

Post by Shutterstock » Mon Jun 26, 2023 3:19 pm

Hi,

I am wondering how to compare RColor. https://www.qcad.org/doc/qcad/latest/de ... color.html
Like I want to check if the color of an object is the same as a specific color.
I tried different things but none of them seem to work :(

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

Re: Comparing RColor

Post by andrew » Mon Jun 26, 2023 6:51 pm

Operators cannot be overwritten in JavaScript, so they are exposed to scripts as functions. The comparison operator (==) is available as equals:

Code: Select all

if (col1.equals(col2)) {
    ...
}

Shutterstock
Active Member
Posts: 29
Joined: Wed Jun 14, 2023 4:02 pm

Re: Comparing RColor

Post by Shutterstock » Mon Jun 26, 2023 9:21 pm

andrew wrote:
Mon Jun 26, 2023 6:51 pm
Operators cannot be overwritten in JavaScript, so they are exposed to scripts as functions. The comparison operator (==) is available as equals:

Code: Select all

if (col1.equals(col2)) {
    ...
}
Cool, thanks, will try it (not an expert in JS lol)

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”