0 Favourites

How do I detect color?

  • Is there a way to tell what color my mouse pointer is currently over? Like, if I have hundreds of colors on my layout & I'm moving the pointer around, how can I make a little window that will A) update a preview of the color & B) display a text version the rgb info?

    I suspect there's a basic concept I need to read up on that would help me solve this on my own, but I'm not sure what it is....It doesn't help that scirra's search function isn't working.

    thanks in advance

  • I'm not sure about the color.. but what are the colors a part of? The background? A sprite? You could always set up an event for checking what object the mouse is currently highlighting every frame I suppose.

  • The colors could either be on a tiled background or a sprite...I ha_en't gotten that far yet. I'm mainly concerned with the mouse being able to detect the color of the pixel, if it's possible.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • The closest you can do is perhaps use the canvas plugin (third party). With it you can get individual pixels from just the object's image. Besides that there isn't a way currently to get the color under the mouse for the whole game area.

  • cool, thanks....I'll look into that

  • in the case of a drawing app for you could use the ReplaceColor effect on a solid white sprite; Set RGB source to 255; and RGB replace values to your new color values; from then on in you know the color of said sprite;

    But if you need to pick colors from individual pixels then go with R0J0's suggestion.

  • The closest you can do is perhaps use the canvas plugin (third party).

    Is there a tutorial anywhere, or maybe just a general usage guide for Canvas? I've been kinda experimenting with it, & it seems like a great tool so I'd like to go a little deeper with it, but I can barely find any info....

  • There's just the plugin's forum topic currently.

  • There's just the plugin's forum topic currently.

    Dear R0J0hound , your canvas plugin is both one of the most promising and yet occluded extensions in Construct 2. The possibilities that it opens, game-play and aesthetically speaking, are tremendous, although hidden behind its complexity that lay in understanding what it's actually capable of doing and how to do it.

    I really wish there was a way to officially implementing the canvas plugin within construct, with detailed manual entry, tutorials and examples

    Have you thought the possibility for the above? Does Ashley have in mind the official implementation of the canvas plugin?

  • I personally really need to take the time out to study expressions --JUST expressions-- & how to construct them. I love playing around with them, but I'm still at the copy-paste-&-tweak level. Seems like understanding that process is going to be the real key to unlocking the plugin's possibilities.

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