Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
find background colour of toolbar

Subject: find background colour of toolbar

From: David Epstein

Date: 26 Nov, 2010 11:21:05

Message: 1 of 5

How can I find out the background colour of a toolbar created by GUIDE? Maybe I need to use an undocumented feature?

Thanks
David

Subject: find background colour of toolbar

From: ImageAnalyst

Date: 26 Nov, 2010 14:05:04

Message: 2 of 5

On Nov 26, 6:21 am, "David Epstein"
<David.Epstein.s...@remove.warwick.ac.uk> wrote:
> How can I find out the background colour of a toolbar created by GUIDE? Maybe I need to use an undocumented feature?
>
> Thanks
> David

-----------------------------------------------------------------
Since the background of the colorbar is just the figure it's sitting
on top of, wouldn't the background color of the colorbar just be the
same as the color of the figure?
backgroundColor = get(gcf, 'color')

Subject: find background colour of toolbar

From: David Epstein

Date: 26 Nov, 2010 16:10:05

Message: 3 of 5

ImageAnalyst <imageanalyst@mailinator.com> wrote

> Since the background of the colorbar is just the figure it's sitting
> on top of, wouldn't the background color of the colorbar just be the
> same as the color of the figure?
> backgroundColor = get(gcf, 'color')

In the gui that I've made with GUIDE, the colour of the toolbar (btw, note it's called the toolbar by GUIDE, not the colorbar) is quite a lot whiter than the background colour of the containing gui (or gcf).

I have been able to guess the colour by trial and error, but that's not a very pleasant process.

David

Subject: find background colour of toolbar

From: ImageAnalyst

Date: 26 Nov, 2010 16:18:42

Message: 4 of 5

Oh, *that*. I'm pretty sure that's a operating system color - isn't
it the same color as your pulldown menus, and (in Windows) that's
controlled by your control panel settings. I don't know if there is a
way to retrieve those from MATLAB, but maybe someone knows.

Subject: find background colour of toolbar

From: Yair Altman

Date: 27 Nov, 2010 17:07:03

Message: 5 of 5

"David Epstein" <David.Epstein.spam@remove.warwick.ac.uk> wrote in message <ico571$p91$1@fred.mathworks.com>...
> How can I find out the background colour of a toolbar created by GUIDE? Maybe I need to use an undocumented feature?
>
> Thanks
> David

Of course you do, and the obvious place to look would be http://UndocumentedMatlab.com ...

In this specific case:
hToolbar = findall(hFig,'tag','FigureToolBar');
jToolbar = get(get(hToolbar,'JavaContainer'),'ComponentPeer');
backgroundColor = get(jToolbar,'Background');

More information: http://UndocumentedMatlab.com/blog/figure-toolbar-customizations/

Related:
http://undocumentedmatlab.com/?s=toolbar
http://undocumentedmatlab.com/blog/modifying-default-toolbar-menubar-actions/
http://undocumentedmatlab.com/blog/figure-toolbar-components/

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us