Microsoft Small Basic

Program Listing:
Embed this in your website
size = "medium" 'enter here the size of the palette - "small", "medium" or "large"

sid = 40 'sid = side of unit square, 40 pixels for "medium" size
If (size = "small") Then
  sid = 30
ElseIf (size = "large") Then
  sid = 50
EndIf
int=math.Floor(sid/10) 'int = lenght of interval
GraphicsWindow.Title = "Palette"
GraphicsWindow.Height = 12*(sid+int)+int
GraphicsWindow.Width = 22*(sid+int)+int
GraphicsWindow.CanResize="false"
GraphicsWindow.BackgroundColor = "black"
GraphicsWindow.Show()
GraphicsWindow.FontName="arial"
GraphicsWindow.FontSize=30
GraphicsWindow.Fontbold="true"

color[1]="IndianRed"
color[2]="LightCoral"
color[3]="Salmon"
color[4]="DarkSalmon"
color[5]="LightSalmon"
color[6]="Crimson"
color[7]="Red"
color[8]="FireBrick"
color[9]="DarkRed"
color[10]="Pink"
color[11]="LightPink"
color[12]="HotPink"
color[13]="DeepPink"
color[14]="MediumVioletRed"
color[15]="PaleVioletRed"
color[16]="LightSalmon"
color[17]="Coral"
color[18]="Tomato"
color[19]="OrangeRed"
color[20]="DarkOrange"
color[21]="Orange"
color[22]="Gold"
color[23]="Yellow"
color[24]="LightYellow"
color[25]="LemonChiffon"
color[26]="LightGoldenRodYellow"
color[27]="PapayaWhip"
color[28]="Moccasin"
color[29]="PeachPuff"
color[30]="PaleGoldenrod"
color[31]="Khaki"
color[32]="DarkKhaki"
color[33]="Lavender"
color[34]="Thistle"
color[35]="Plum"
color[36]="Violet"
color[37]="Orchid"
color[38]="Fuchsia"
color[39]="Magenta"
color[40]="MediumOrchid"
color[41]="MediumPurple"
color[42]="BlueViolet"
color[43]="DarkViolet"
color[44]="DarkOrchid"
color[45]="DarkMagenta"
color[46]="Purple"
color[47]="Indigo"
color[48]="SlateBlue"
color[49]="DarkSlateBlue"
color[50]="MediumSlateBlue"
color[51]="GreenYellow"
color[52]="Chartreuse"
color[53]="LawnGreen"
color[54]="Lime"
color[55]="LimeGreen"
color[56]="PaleGreen"
color[57]="LightGreen"
color[58]="MediumSpringGreen"
color[59]="SpringGreen"
color[60]="MediumSeaGreen"
color[61]="SeaGreen"
color[62]="ForestGreen"
color[63]="Green"
color[64]="DarkGreen"
color[65]="YellowGreen"
color[66]="OliveDrab"
color[67]="Olive"
color[68]="DarkOliveGreen"
color[69]="MediumAquamarine"
color[70]="DarkSeaGreen"
color[71]="LightSeaGreen"
color[72]="DarkCyan"
color[73]="Teal"
color[74]="Aqua"
color[75]="Cyan"
color[76]="LightCyan"
color[77]="PaleTurquoise"
color[78]="Aquamarine"
color[79]="Turquoise"
color[80]="MediumTurquoise"
color[81]="DarkTurquoise"
color[82]="CadetBlue"
color[83]="SteelBlue"
color[84]="LightSteelBlue"
color[85]="PowderBlue"
color[86]="LightBlue"
color[87]="SkyBlue"
color[88]="LightSkyBlue"
color[89]="DeepSkyBlue"
color[90]="DodgerBlue"
color[91]="CornflowerBlue"
color[92]="MediumSlateBlue"
color[93]="RoyalBlue"
color[94]="Blue"
color[95]="MediumBlue"
color[96]="DarkBlue"
color[97]="Navy"
color[98]="MidnightBlue"
color[99]="Cornsilk"
color[100]="BlanchedAlmond"
color[101]="Bisque"
color[102]="NavajoWhite"
color[103]="Wheat"
color[104]="BurlyWood"
color[105]="Tan"
color[106]="RosyBrown"
color[107]="SandyBrown"
color[108]="Goldenrod"
color[109]="DarkGoldenrod"
color[110]="Peru"
color[111]="Chocolate"
color[112]="SaddleBrown"
color[113]="Sienna"
color[114]="Brown"
color[115]="Maroon"
color[116]="White"
color[117]="Snow"
color[118]="Honeydew"
color[119]="MintCream"
color[120]="Azure"
color[121]="AliceBlue"
color[122]="GhostWhite"
color[123]="WhiteSmoke"
color[124]="Seashell"
color[125]="Beige"
color[126]="OldLace"
color[127]="FloralWhite"
color[128]="Ivory"
color[129]="AntiqueWhite"
color[130]="Linen"
color[131]="LavenderBlush"
color[132]="MistyRose"
color[133]="Gainsboro"
color[134]="LightGray"
color[135]="Silver"
color[136]="DarkGray"
color[137]="Gray"
color[138]="DimGray"
color[139]="LightSlateGray"
color[140]="SlateGray"
color[141]="DarkSlateGray"
color[142]="Black"

For i = 0 To 11
  For j = 1 To 12
    GraphicsWindow.brushcolor=color[i*12+j]
    GraphicsWindow.FillRectangle(int+i*(sid+int),int+(j-1)*(sid+int),sid,sid)
  Endfor
EndFor
GraphicsWindow.PenColor=" white"
GraphicsWindow.DrawRectangle(int+(i-1)*(sid+int),9*(sid+int)+int,sid,sid)
GraphicsWindow.DrawRectangle(12*(sid+int)+int,int,10*(sid+int)-int,10*(sid+int)-int)
GraphicsWindow.Mousemove = onmousemove

Sub onmousemove
  x = GraphicsWindow.MouseX
  y = GraphicsWindow.MouseY
  GraphicsWindow.BrushColor = "black"
  GraphicsWindow.FillRectangle(12*(sid+int)+int,10.5*(sid+int)+int,10*(sid+int)+int,1.5*sid)
  c = 12*Math.Floor(x/(sid+int))+1+Math.Floor(y/(sid+int))
  GraphicsWindow.BrushColor = color[c]
  GraphicsWindow.FillRectangle(12*(sid+int)+int,int,10*(sid+int)-int,10*(sid+int)-int)
  GraphicsWindow.BrushColor = "white"
  GraphicsWindow.DrawText(12*(sid+int)+int,10.5*(sid+int)+int,color[c])
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.