I think you can also rename argbToHex, which would correctly indicate that the first byte is an alpha channel.
It looks like you have used appybuilder code editor. You can't rename java file there so create a new project with file name color.java and copy-paste your code there and recompile it.
I've already tried that multiple Times but IT doesn't work.
Make sure that your java file name and class name is same.
i did that but then i get this error:
Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml
extensions:
clean:
[delete] Deleting directory /projects/goldv2/appinventor-sources/appinventor/components/build
BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:34: The following error [delete] Deleting directory /projects/goldv2/appinventor-sources/appinventor/components/reports
init:
common_CommonUtils:
init:
CommonUtils:
common_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128
CopyToRunLibDir:
components_AndroidRuntime:
init:
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/build/components
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/reports
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/reports/raw
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/reports/html
CommonConstants:
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
[javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[javac] Creating empty /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants/com/google/appinventor/components/common/package-info.class
[jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/build/components/CommonConstants.jar
[jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/build/components/CommonConstants-gwt.jar
HtmlEntities:
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
[javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
[jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/components/build/HtmlEntities.jar
common_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128
AndroidRuntime:
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:18: error: Color is already defined in this compilation unit
[javac] import android.graphics.Color;
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:40: error: cannot find symbol
[javac] return Color.parseColor(hexColorCode);
[javac] ^
[javac] symbol: method parseColor(String)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:46: error: cannot find symbol
[javac] return Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
[javac] ^
[javac] symbol: method argb(int,int,int,int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:52: error: cannot find symbol
[javac] float r = (Color.red(firstColor) * ratio) + (Color.red(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method red(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:52: error: cannot find symbol
[javac] float r = (Color.red(firstColor) * ratio) + (Color.red(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method red(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:53: error: cannot find symbol
[javac] float g = (Color.green(firstColor) * ratio) + (Color.green(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method green(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:53: error: cannot find symbol
[javac] float g = (Color.green(firstColor) * ratio) + (Color.green(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method green(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:54: error: cannot find symbol
[javac] float b = (Color.blue(firstColor) * ratio) + (Color.blue(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method blue(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:54: error: cannot find symbol
[javac] float b = (Color.blue(firstColor) * ratio) + (Color.blue(secondColor) * inverseRation);
[javac] ^
[javac] symbol: method blue(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:55: error: cannot find symbol
[javac] return Color.rgb((int) r, (int) g, (int) b);
[javac] ^
[javac] symbol: method rgb(int,int,int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:60: error: cannot find symbol
[javac] return Color.argb((int) alpha, (int) red, (int) green, (int) blue);
[javac] ^
[javac] symbol: method argb(int,int,int,int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:65: error: cannot find symbol
[javac] int alpha = Color.alpha(RGBAColor);
[javac] ^
[javac] symbol: method alpha(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:66: error: cannot find symbol
[javac] int red = Color.red(RGBAColor);
[javac] ^
[javac] symbol: method red(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:67: error: cannot find symbol
[javac] int green = Color.green(RGBAColor);
[javac] ^
[javac] symbol: method green(int)
[javac] location: class Color
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/lukehoogenboom/Color/Color.java:68: error: cannot find symbol
[javac] int blue = Color.blue(RGBAColor);
[javac] ^
[javac] symbol: method blue(int)
[javac] location: class Color
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 15 errors
[javac] 1 warning
BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.
Total time: 4 seconds
The file name should not be the same as imports or object names.
Update
Update log:
The name has been changed to Colour instead of Color_Exstension and now follows the naming conventions as reqeusted by @Taifun
Also I really wan't to thank @Kumaraswamy, @Techno_Vedang and @Taifun for helping me change the name.
NOTE: the new exstension won't upgrade to the old one but wil insert a new one.
download:
com.appybuilder.lukehoogenboom.Colour.aix (7.6 KB)
great!
please edit your first post in this thread and update the screenshots
thank you
Taifun
I've updated the screenshots to the new version.
Also i've deleted the update logs to avoid confusion.
Thank you!
UPDATE
Honestly, I didn't try it out but someone might like to have the range of all colors where R, G or B is absence. It provides a nice color range, almost rainbow, about .
It goes from red -> yellow->...->red.
The number goes from 1 --> 1531
I had to analyse all thise combinations with an Excel, to transform then into a formula.
Well done!
Also:
Search here for color
to find several extensions that provide a colour picker
A bit late.
P.S. I already understood What she meant.