MATLAB Answers

how do I change Matlab GUI components color?

4 views (last 30 days)
fatih orman
fatih orman on 31 Mar 2020
Edited: fatih orman on 13 Apr 2020
I want to make a dark mode, normal mode feature in userpanel with Radio buttons in my GUI panel with the code like down below. I can change panel backgroundcolour, but how can I adapt this code for other parts like below?
uibuttongroup, text, pushbutton (foregroundcolor, backgroundcolor, highlightcolor)
that works good;
set ( gcf, 'Color', [0 0 0] )
at these examples I'm getting error;
set ( edit1, 'Color', [0 0 0] )
set ( edit1, 'BackgroundColor', [0 0 0] )
set ( edit1, 'ForegroundColor', [0 0 0] )

  0 Comments

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 31 Mar 2020
Edited: Geoff Hayes on 31 Mar 2020
fatih - what is the full error message that you are observing? Are you using GUIDE, App Designer, or have you created your GUI programmatically? If using GUIDE, then you will need to use the handles structure to reference your edit1 control
set(handles.edit1, 'BackgroundColor', [0 0 1]);
The background color can be changed. Programmatically this can be done as
hEditControl = uicontrol('Style','edit');
set(hEditControl, 'BackgroundColor', [0 0 1]);

  1 Comment

fatih orman
fatih orman on 7 Apr 2020
i guess thats the answer. i had to add handles prefix. thanks a lot!

Sign in to comment.

More Answers (0)

Sign in to answer this question.