how do I change Matlab GUI components color?

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] )

 채택된 답변

Geoff Hayes
Geoff Hayes 2020년 3월 31일
편집: Geoff Hayes 2020년 3월 31일

0 개 추천

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]);

댓글 수: 3

fatih orman
fatih orman 2020년 4월 7일
i guess thats the answer. i had to add handles prefix. thanks a lot!
Mai Thành
Mai Thành 2021년 12월 19일
How can I change the font of the output text by using that structure ?
Geoff Hayes
Geoff Hayes 2021년 12월 19일
@Mai Thành - see font for details.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

질문:

2020년 3월 31일

댓글:

2021년 12월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by