Skip to main content


When designing an interface for an app or a website, the hex values for colors are needed. I just wanted a tool that allowed me to play around with hex values and see the result color. The main purpose for coding this was to experiment with WebView in Android. It also felt like a fun little 2-3 hours why-not-just-do-it project.
The three Slide bars correspond to Red, Green and Blue values respectively. First of all, a html script with background color information based on SlideBar inputs is generated. The Web View then uses the generated html script to build a html web-page.
Users can also use the EditText and Submit button to input hex values. Initially, I had not planned on putting this functionality. I later decided to add it because several people were giving bad ratings to similar app in the appstore for missing it. Also, it was a fairly simple addition.

Option 1: Slide the SeekBars to get required values. 

For example, when Red SeekBar is changed:

public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {

 String red = Integer.toHexString(arg1);
 if (red.length() == 1) {
  red = "0" + red;

 String green = Integer.toHexString(greenSeekBar.getProgress());
 if (green.length() == 1) {
  green = "0" + green;

 String blue = Integer.toHexString(blueSeekBar.getProgress());
 if (blue.length() == 1) {
  blue = "0" + blue;

 color = "<!DOCTYPE html><html><body bgcolor=" + red + green + blue + "></body></html>";

 htmlDisplay.loadData(color, "text/html", null);
 result.setText("#" + red + green + blue); 

Option 2: Use the EditText to enter the value. 

This option will change the SeekBars position to input values. Once that happens, request has been deduced to act similarly as Option 1.

String Input = input.getText().toString() + "";
if ((Input.length() == 6) && (Input.matches("[0-9A-Fa-f]+"))) {
 redSeekBar.setProgress(Integer.parseInt(Input.substring(0, 2), 16));
 greenSeekBar.setProgress(Integer.parseInt(Input.substring(2, 4), 16));
 blueSeekBar.setProgress(Integer.parseInt(Input.substring(4, 6), 16));
} else {

Popular posts from this blog



The Zorganian Republic has some very strange customs. Couples only wish to have female children as only females can inherit the family's wealth, so if they have a male child they keep having more children until they have a girl. If they have a girl, they stop having children. What is the ratio of girls to boys in Zorgania?
The ratio of girls to boys in Zorgania is 1:1. This might be a little counter-intuitive at first. Here are some ways of tackling this problem. 1. Monte Carlo Simulation: Although, Monte Carlo simulation does not necessarily show why the result is 1:1, it is appropriate because of the very counter-intuitive nature of the problem. At the very least, it helps us see that the result is indeed 1:1. Therefore, this is a good start.
The following R code estimates the probability of a child being a boy in Zorgania. 
couples <-100000 boycount <-0for (i in1:couples){ # 0: boywhile (sample(c(0,1),1) ==0) { boycount=boycount+1 } } probability <- boycount/(co…

Simple Launcher

A simple minimal launcher application for Android devices that shows battery percentage using lzyzsd's CirclProgress library (ArchProgress used in this case) and BroadcastReciever for battery state, Android's clock widgets, a built-in flash light switch and an app list view that can be toggled. Currently, the toggle simply filters all the app that I am working on at present. Future implementation can allow users to select their favorite apps or populate second toggle based on the most used applications.