I was able to create this functionality using few edits of my own to the native components.I used a split button and attached a color menu to it and made it like a color picker.
SplitButton colorPicker = new SplitButton();
final ColorMenu colorMenu = new ColorMenu();
colorMenu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>(){
public void onValueChange(ValueChangeEvent<String> event){
String color = event.getValue();
System.out.println("Color value is "+color);
StyleInjector.inject(".CustomColor1 > div > div { background-color: "+color+" !important; border-color: #c4c5c5 !important;} ");
colorMenu.hide();
}
});
colorPicker.setMenu(colorMenu);
colorPicker.setHeight(20);
colorPicker.setWidth(150);
StyleInjector.inject(".CustomColor1 > div {background:none !important; background-image:none !important; background-color: #FFFFFF !important; border-color: #c4c5c5 !important; border-width: 1px !important;} ");
colorPicker.setStyleName("CustomColor1");
and I have got the desired output like this.

So ,I have achieved what i wanted.
Happy coding!