proc/SWITCH(mob/M, var/Title, var/Text = "", var/Options = list(), var/Fade = 0, var/CloseOnFade = 0)
if(winget(M, "Switch", "is-visible") == "true") return
//Clean up the interface and write the text//
M << output(null, "Switch.grid1");M.List.Cut() //Clear grid, and clear the list.
winset(M,"Switch.Title", "text = '[Title]'")
winset(M, "Switch.grid1", "cells = 0x0") // Another way of clearing the grid...
winset(M,"Switch.grid1","style='body{background-color:#FF0000;}'") //Make sure the cells are not highlighted.
winset(M,"Switch.Text","text = '[Text]'") // Add the text
winset(M, "Switch.grid1", "cells = 1x[length(Options)]") // Create the right number of cells based on the number of options.
/////Lets start adding the options///////////
for(var/a in Options)
var/Option/O = new ; O.name = "[a]"
M.List.Add(O)
for(var/Z in M.List)
M << output("<font color = red>[Z]</font>","Switch.grid1:1,[M.List.Find(Z)]")
Problem description:I'm making some modifications to Kidpaddle45's Interface library to better fit my game's concept. I can't seem to get the text color of the options that populate within grid1 to change, neither through the skin file nor code. This current futile attempt actually just colors in the whole box area for the option as red. What am I doing wrong, and what is the best way to achieve a color change for var/Z?
1) You don't need the "var" keyword in proc arguments. It's doing nothing. Get rid of it.
2) In HTML, never put a space around the = for an attribute. It just isn't done.
3) The M.List.Find() call is totally wrong. Instead, use a local var as a counter and increment it with each item in the list.
4) It makes no sense to have two loops: one to fill the list and one to fill the grid. Those should be the same loop.