Here is a screenshot of my application:

I can access buttons using R.id.button1 and change its background using
case R.id.lightgreen:
for (Button currentButton : buttons) {
currentButton.setBackgroundResource(R.drawable.lightgreen);
}
Is there any way to access action bar and its overflow menu to set their color in same way?
[EDIT]
ActionBar actnbar;
actnbar.setBackgroundDrawable(R.drawable.blue_button);
this gives me error asking to convert blue_button to drawable but if i do that then i won't be able to set buttons.
Define your custom style.xml in values folder of your project like this :
And then in your AndroidManifest.xml :
You also must take care of supporting other api-s (other values folders).
If you are using actionbarcompat support library you can access actionbar in your activity that extends
ActionBarActivitywithgetSupportActionBar()and usesetStackedBackgroundDrawable()orsetBackgroundDrawable()or corresponding getActionBar() method if not using support library.