Microsoft Small Basic

Program Listing: TDP275
' SmallBasic Version 1.2
' Program: TWColorCombis
' Changelog:
' Author: Pappa Lapub
' Website: https://social.msdn.microsoft.com/Forums/en-US/f56be1a4-4349-499e-8c41-e8026f332cc9/bilzu-program
' ImportURL: http://smallbasic.com/program/?
' Extension: ---
' Comment:
'
' Variables:
' ToDo:
' ================================================================================
w = 7
lf = Text.GetCharacter(10)
nbsp = Text.GetCharacter(160)
For n = 1 To 3
spc[n] = Text.Append(spc[n-1], nbsp)
EndFor
For n = 1 To 24
ul = Text.Append(ul, "_") ' separator line
EndFor

cols = "0=Black;1=DarkBlue;2=DarkGreen;3=DarkCyan;4=DarkRed;5=DarkMagenta;6=DarkYellow;7=Gray;"
cols = cols +"8=DarkGray;9=Blue;10=Green;11=Cyan;12=Red;13=Magenta;14=Yellow;15=White;"
'' de-DE:
'cols = "0=Schwarz;1=Dunkelblau;2=Dunkelgrün;3=Blaugrün;4=Dunkelrot;5=Lila;6=Ocker;7=Hellgrau;"
'cols = cols +"8=Dunkelgrau;9=Blau;10=Grün;11=Zyan;12=Rot;13=Magenta;14=Gelb;15=Weiß;"

hex = "0=#000000;1=#000080;2=#008000;3=#008080;4=#800000;5=#800080;6=#808000;7=#C0C0C0;"
hex = hex +"8=#808080;9=#0000FF;10=#00FF00;11=#00FFFF;12=#FF0000;13=#FF00FF;14=#FFFF00;15=#FFFFFF;"
nCols = Array.GetItemCount(cols)

bg = TextWindow.BackgroundColor
fg = TextWindow.ForegroundColor
TextWindow.Title = "BG/FG color combinations TW"
TextWindow.WriteLine(" Back-,ForegroundColor combinations (eg. 0,11 bg..0=Black, fg..11=Cyan)"+ lf)

For y = 0 To nCols-1
TextWindow.BackgroundColor = y
For x = 0 To nCols-1
TextWindow.ForegroundColor = x
str = spc[1] + y +","+ x
TextWindow.Write(str + spc[w-Text.GetLength(str)])

If x = 7 Then
TextWindow.BackgroundColor = bg
TextWindow.ForegroundColor = fg
TextWindow.WriteLine(spc[2]+ y +"="+ cols[y] +" ("+ hex[y] +")")
TextWindow.BackgroundColor = y
EndIf
EndFor
TextWindow.BackgroundColor = bg
TextWindow.ForegroundColor = fg

If y = 7 Then
TextWindow.WriteLine(spc[1] + ul) ' nbsp + ul)
Else
TextWindow.WriteLine(spc[1]) ' nbsp)
EndIf
EndFor

TextWindow.BackgroundColor = bg
TextWindow.ForegroundColor = fg
TextWindow.PauseWithoutMessage()
Program.End()