Introduction
A non-visible extension that provides some tools to work with colors.
Release date: 2022-04-19T11:00:00Z
Version: 2
Package name: com.gordonlu.colorutilities
Built with: Niotron IDE
An integer color, represented in a number (e.g. 12345678), is the standard color used in App Inventor.
Documentation
BlendColors
Blends two colors together. The ratio parameter should be a value between 0 and 1.
Returns: color
Parameters: color1 = color, color2 = color, ratio = number (double)
ConvertHexToInt
Convert a hex color to a integer color, which is used in the standard App Inventor color system.
Returns: number (int), or color
Parameters: hexColor = text
ConvertIntToHex
Convert a integer color to a hex color.
Returns: text
Parameters: number (int), or color
DarkenColor
Darkens the color with the given factor. The factor should be a value between 0 and 1.
Returns: color
Parameters: color = color, factor = number (double)
GetLuminance
Returns the luminance of a color as a double number between 0 and 1.
Returns: number (double)
Parameters: color = color
IsDarkColor
Checks whether the color is a dark color or a light color.
Returns: boolean
Parameters: color = color
LightenColor
Lightens the color with the given factor.
Returns: color
Parameters: color = color, factor = number (double)
FAQ
Q1: Please provide the random color / arbitrary color block.
A1: Blocks-only solution:
Q2: Please provide the SetAlphaValue block.
A2: Another blocks only solution:
Credits
Some snippets taken from https://vimsky.com/zh-tw/examples/detail/java-method-android.graphics.Color.argb.html, and some reference taken from https://docs.kodular.io/components/utilities/color-utilities/. Thank you Kodular!
Downloads
AIX:
com.gordonlu.colorutilities.aix (8.1 KB)
JAVA:
ColorUtilities.txt (3.8 KB)
Made with Niotron IDE.
Kindly PM me if you have any questions! Also, if you like my extension, please like it! It takes some effort for me to make it...
Likes tell me the general user feedback of my extension. If you read this extension, please take 20 seconds to drop by and give a like!
If you have any features that you want to add and you know the code, PM me or directly reply below using the button.
If you find any bugs, please reply below.
P.S. I will release my next extension very soon. Are you ready for it?
Gordon Lu