Stencyl 3.4.0 is now out. Get it now!

Color Utils Extension [1.0.2]

ETHproductions

  • *
  • Posts: 400
Color Utilities Extension

Welcome to the Color Customization Zone! With the Color Utilities Extension, you can adjust colors at runtime, as well as define colors using HSL and hex values. You can use these blocks to modify an image, adjust color attributes, or even put a color-selection tool in-game!

NOTE: This is my first extension, so it might be a little sloppy. Please post how you think I can make it better!

I know that it works on Flash and Windows. (Please let me know if it works on Mac, Linux, iOS, or Android!)
Designed to work with Stencyl v3.1. Do not use in Stencyl v2.2 or below!

Features
- get, set and shift RGB/HSL values from colors
- get negative or opposite versions of colors
- define a color with HSL or hex values

- Download
- Sample project (try it below!)

(How to Install and Update an Extension)


Blocks



Returns a color value (red, green, blue, hue, saturation or lightness) from a color.




Returns the color that was put in, but with a color value set to the input number.
Useful for editing a color attribute.




Returns the color that was put in, but with a color value changed by the input number.
Useful for performing tasks like hue-shifts on images, or editing a color attribute.




Returns the negative or opposite of the color that was put in.
'negative' reverses each RGB value, while 'opposite' reverses the hue value.
E.g. Light green, when made negative, would create violet; on the other hand, when made opposite, it would create pink.




Converts an HSL value into a color.
The hue is a number from 0-359 (it automatically loops around, so 360 = 0).
Saturation should be between 0-160, and lightness/luminance between 0-240. Both are self-adjusting, so any value outside the range will work, but will be replaced by the maximum or minimum value.




Converts a hexadecimal value into a color.
Upper- and lower-case are completely interchangeable; even aF0eDc will work.
The block can also handle many formats, including six-digits like ffffff, #ffffff and 0xffffff, and three-digits like fff, #fff, and 0xfff.


Version History

1.0 - Initial release (08/09/14)
Blocks:
 - get/set/shift (R, G, B, H, S, L) value from color
 - negative/opposite of color
 - hue, sat, lum as color
 - convert hex to color

1.0.1 (08/10/14)
 - Minor updates to the haXe files and Manual.txt.

1.0.2 (08/29/14)
 - Minor updates to the code and sample, as well as laying the base for the next update.

Planned features:
 - get/define color by name
 - pre-defined list of all HTML colors
 - blocks for adjusting images - This can already be achieved with effects


If you have any questions, problems, or suggestions, feel free to post them! :)
ETH

« Last Edit: July 07, 2015, 12:49:48 pm by ETHproductions »
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Stevetheipad

  • Posts: 1304
This is super cool, I could have used this on my last app!

Photon

  • Posts: 2698
Oh wow, this looks nifty! Nice job.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

ETHproductions

  • *
  • Posts: 400
Thanks a bunch, guys! I'm working on the sample project right now; hopefully I'll post it tomorrow.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

1MrPaul1

  • *
  • Posts: 1119
very very good, very useful extention, everybody must have it!
thank you!
only one question, how heavy this color operations for performance?

ETHproductions

  • *
  • Posts: 400
only one question, how heavy this color operations for performance?

Just as much as the built-in code blocks. :) When the blocks are used to work with large-ish images, it starts to get slow, but this is because separately adjusting each pixel in an image takes a while to compute.

Also, the sample project is ready! It's got a color picker and an mini image editor. Here it is:

<a href="https://www.dropbox.com/s/fw6hh0d03mlycim/Color%20Utilities%20Sample.swf?raw=1" target="_blank" class="new_win">https://www.dropbox.com/s/fw6hh0d03mlycim/Color%20Utilities%20Sample.swf?raw=1</a>

Update (08/29/14): The color picker now has a randomize button! It's very good for finding new and unusual colors.

« Last Edit: December 12, 2014, 10:04:40 am by ETHproductions »
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Unept

  • *
  • Posts: 337
This is great. Especially having the ability to control colors through HSL values. I've already implemented some of it in my game project and it's working like a charm. Well done!
Hue Ball: iOS/Android  |  Lava Bird: iOS/Android   |   Disposabot   |   Twitter

ETHproductions

  • *
  • Posts: 400
Great to hear! I'm also working on a new extension for drawing arcs, rotated rectangles, regular polygons, and a few other shapes. Hopefully it will be as useful as this one.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

MichaelPel

  • *
  • Posts: 456
Love this - using hex values makes life so much easier. You've saved me hours upon hours of mess, thank you!

Bhoopalan

  • *
  • Posts: 864
BEAuuuutiful extension. Great and endless possibilities.
If I helped you at anytime, help me back build my twitter followers :)
https://twitter.com/imbhoopalan