lnInc = 255/(2^4-1) For lnColor = 0 to 2^4-1 STORE round(lnColor * lnInc,0) TO lnRed, lnGreen, lnBlue lnShp = lnShp+1 lcName = 'shp'+trans(lnShp) lcLblName = 'lbl'+trans(lnShp) .addobject(lcName, 'myShape', ; lnShp, lnPerRow, lnRed, lnGreen, lnBlue) lcWebColor = right(trans(rgb(lnBlue,lnGreen,lnRed),'@0'),6) lcHTML = lcHTML + ; iif((lnShp-1)%lnPerRow=0,'&;lt/TR><TR>','') + ; '<TD bgcolor=#'+lcWebColor+'>'+lcWebColor+'</TD>' EndforChange
.Height = 20 * 16 * to .Height = 20 * 17>>You could either use something like this or get HTML directly from MSDN help (named colors) :
lcHTML = '<HTML><BODY><TABLE><TR>' >>oForm=createobject('Form') >>With oForm >> .ShowTips = .t. >> lnPerRow = 16 >> Store 255/(2^3-1) to lnRedInc, lnGreenInc >> lnBlueInc = 255/(2^2-1) >> lnShp=0 >> For blue = 0 to 2^2-1 >> For green = 0 to 2^3-1 >> For red = 0 to 2^3-1 >> lnRed = round(red * lnRedInc,0) >> lnGreen = round(green * lnGreenInc,0) >> lnBlue = round(blue * lnBlueInc,0) >> lnShp = lnShp+1 >> lcName = 'shp'+trans(lnShp) >> lcLblName = 'lbl'+trans(lnShp) >> .addobject(lcName, 'myShape', ; >> lnShp, lnPerRow, lnRed, lnGreen, lnBlue) >> lcWebColor = right(trans(rgb(tnBlue,tnGreen,tnRed),'@0'),6) >> lcHTML = lcHTML + ; >> iif((lnShp-1)%lnPerRow=0,'</TR><TR>','') + ; >> '<TD bgcolor=#'+lcWebColor+'>'+lcWebColor+'</TD>' >> Endfor >> Endfor >> Endfor >> lcHTML = lcHTML+'</TR></TABLE></BODY></HTML>' >> Strtofile(lcHTML,'256Colors.htm') >> .SetAll('Visible',.t.) >> .Height = 20 * 16 >> .Width = 20 * 16 >> .Show >>Endwith >>