Retrieve and oject's color

0 favourites
From the Asset Store
Color all tiles with the same color in 22 moves or less!
  • Hello,

    I am trying to make a color picker, and it would be easier to have access to the Color property of the object.

    Is that possible? Is there an easier way?

    Thank you.

  • You can retrieve the Color property of an object with the ColorValue expression.

  • You can retrieve the Color property of an object with the ColorValue expression.

    Hi Ashley, can u please explain how to use that color value expression? I am also in desperate need of the same.

  • As seen in the manual article on common expressions

    Appearance

    ColorValue

    A number representing the color property of the instance. This can be used with the Set color action to set an object's color to match another object.

    What more would you need to know exactly jatin1726 ?

  • You use NameOfTheObject.ColorValue to access the value.

  • jatin1726 ColorValue expression only allows to access the color value you set previously with "Set color" action.

    If you need to read any pixel color from an image, you need to use Canvas object in C2 or DrawingCanvas in C3.

  • Ashley , could you please explain how the color is encoded in the ColorValue? I.e. is there a way to extract r/g/b/alpha channels from it? I couldn't find this info anywhere.

  • Ashley , could you please explain how the color is encoded in the ColorValue? I.e. is there a way to extract r/g/b/alpha channels from it? I couldn't find this info anywhere.

    thanks dop2000 for bringing this. Me too looking for the solution of same. Ashley please help us in this.

  • IIRC there isn't a way at the moment. The ColorValue expression currently exists only so you can set an object's color to the same color as another object.

  • There are javascript functions in the c3runtime to translate a color value to an R, G, B value.

    Ashley - is there a reason you would not want to share the code of the functions (so others could put the function code itself embedded as a new function in C3 events), I've tested using the function code myself locally using C3 event scripts and they seem to work well.

    Reminder:

  • There are javascript functions in the c3runtime to translate a color value to an R, G, B value.

    Ashley - is there a reason you would not want to share the code of the functions (so others could put the function code itself embedded as a new function in C3 events), I've tested using the function code myself locally using C3 event scripts and they seem to work well.

    Reminder:

    Mikal, i m not into coding, can u help me how to achieve color extraction without coding?

  • Mikal, i m not into coding, can u help me how to achieve color extraction without coding?

    DrawingCanvas (https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/drawing-canvas) allows you to extract specific color channel from a snapshot. You possibly can use the expressions of the plugin.

  • > Mikal, i m not into coding, can u help me how to achieve color extraction without coding?

    DrawingCanvas (https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/drawing-canvas) allows you to extract specific color channel from a snapshot. You possibly can use the expressions of the plugin.

    thanks for sharing this. But for less experience ppl like me it is difficult to understand that theory. So we need to add a canvas elemement first and then take a snap shot? and then find snapshot cordinate? but how we will get all cordinate to get rgba? is it possible to help us with any sample capx..that will be very big help

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • jatin1726 Check out this Color Picker template:

    howtoconstructdemos.com/hsv-color-picker-tool-c3p

    If this is not what you need, please give more information. Are you trying to read pixel color from a sprite?

  • jatin1726 Check out this Color Picker template:

    https://howtoconstructdemos.com/hsv-color-picker-tool-c3p/

    If this is not what you need, please give more information. Are you trying to read pixel color from a sprite?

    Actually I am opening camera and trying to detect specific color, like red color when in comes in camera scene. and then a alert can say it is red color. but for that it has to extract values of the pixel and then throw the message that red color it is .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)