GUI Table Dropdown List with Entries in Different Colors via HTML

3 views (last 30 days)
I am trying to have a dropdown list for each entry in a specific column of my uitable to feature a list of choices with different color fonts.
set(handles.dataTable_old,'ColumnFormat',{[],[],[],[],... {colorEntry('entry1','green'),colorEntry('entry2','red'),colorEntry('entry3','blue')},... [],[]});
where colorEntry is a function I wrote that outputs a string of HTML code with the entry in colored font:
function [colorHTML] = colorEntry(entry, color)
choices = {'red','green','blue','yellow','purple'};
codes = {'#FF0000','#008000','#1E90FF','#FF8C00','#FF00FF'};
indTrue = find(strcmp(color,choices));
colorCode = codes{indTrue};
% format into HTML code
htmlCode = '<html><span style="color: %s; font-weight: bold;">%s</span></html>';
colorHTML = sprintf(htmlCode,colorCode,entry);
end
The dropdown list works to the point of showing the selections in color:
However as soon as I make a selection, the original htmlCode shows up instead:
Is there any workaround to this issue? Thanks in advance.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!