Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
How to get R, G, or B from a color set by extension color property?

xanimalkingx
Registered User
Quote
2018-07-16 01:34:04

I am developing a action extension and have a color property. However, I need the individual values from the color, like the R, G, and B values.
I don't see any function like getRed(), so how do I do this?


niko
Moderator
Quote
2018-07-16 08:38:12

These should work:

function getRedColor(clr)
{
return ((clr & 0x00FF0000) >> 16);
}

function getGreenColor(clr)
{
return ((clr & 0x0000FF00) >> 8);
}

function getBlueColor function(clr)
{
return ((clr & 0x000000FF));
}



xanimalkingx
Registered User
Quote
2018-07-16 16:31:43

It works but you should add these as official functions in the scripting API.


niko
Moderator
Quote
2018-07-17 05:15:40

You are right, probably going to add those.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact