How to assign different color to items in drop-down list in app designer?

30 views (last 30 days)
Is it possible to provide different color to individual item in a drop-down list in app designer?
I have multiple entires in my drop down list. I want to assign either red or green font color to indiviual drop-down item based on my requirement.
How to do this?
  2 Comments

Sign in to comment.

Accepted Answer

Jasmine Poppick
Jasmine Poppick on 17 Mar 2023
Starting in R2023a you can do this using the addStyle function.
In the StartupFcn callback of the app, you can create a style using uistyle and specify the BackgroundColor property, and then add the style to an item of the drop-down component. For example:
s = uistyle(BackgroundColor="green");
addStyle(app.DropDown,s,"item",2)

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!