ShiftOS-TheRevival-Old/ShiftOS-TheRevival/MainForms/TerminalColorSystem.vb

212 lines
10 KiB
VB.net
Raw Normal View History

2022-11-06 07:24:53 +00:00
Module TerminalColorSystem
'GUIDE to COLORS in TERMINAL
'Using the same Hexadecimal numbering as what Command Prompt used to:
'0 = Black 8 = Gray
'1 = Blue 9 = Light Blue
'2 = Green A = Light Green
'3 = Aqua B = Light Aqua
'4 = Red C = Light Red
'5 = Purple D = Light Purple
'6 = Yellow E = Yellow
'7 = Dark Gray F = White
Public BgColor As Color
Public FgColor As Color
Public Sub DisplayColors()
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "TERMINAL SUPPORTED COLORS" & Environment.NewLine & Environment.NewLine
2022-11-06 07:24:53 +00:00
If Strings.AvailableFeature(10) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "0 = Black 8 = Gray"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "0 = Black 8 = ???"
2022-11-06 07:24:53 +00:00
End If
If Strings.AvailableFeature(14) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "1 = Blue 9 = Light Blue"
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "2 = Green A = Light Green"
2022-11-06 07:24:53 +00:00
Else
If Strings.AvailableFeature(13) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "1 = ??? 9 = Light Blue"
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "2 = Green A = ???"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "1 = ??? 9 = ???"
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "2 = ??? A = ???"
2022-11-06 07:24:53 +00:00
End If
End If
If Strings.AvailableFeature(15) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "3 = Aqua B = Light Aqua"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "3 = ??? B = ???"
2022-11-06 07:24:53 +00:00
End If
If Strings.AvailableFeature(14) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "4 = Red C = Light Red"
2022-11-06 07:24:53 +00:00
ElseIf Strings.AvailableFeature(13) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "4 = ??? C = Light Red"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "4 = ??? C = ???"
2022-11-06 07:24:53 +00:00
End If
If Strings.AvailableFeature(15) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "5 = Purple D = Light Purple"
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "6 = Yellow E = Yellow"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "5 = ??? D = ???"
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "6 = ??? E = ???"
2022-11-06 07:24:53 +00:00
End If
If Strings.AvailableFeature(10) = "1" Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "7 = Dark Gray F = White"
2022-11-06 07:24:53 +00:00
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "7 = ??? F = White"
2022-11-06 07:24:53 +00:00
End If
End Sub
Public Sub GetColor(App As String, Bg As String, Fg As String)
Select Case App
Case "terminal"
BgColor = Color.Black
FgColor = Color.White
Case "infobar"
BgColor = Color.White
FgColor = Color.Black
End Select
If Bg = Fg Then
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "Background and Foreground Color cannot be same!"
2022-11-06 07:24:53 +00:00
Else
If Strings.AvailableFeature(10) = "1" Then
Select Case Bg
Case "0"
BgColor = Color.Black
Case "7"
BgColor = Color.Silver
Case "8"
BgColor = Color.Gray
Case "f"
BgColor = Color.White
Case "2", "9", "c"
If Strings.AvailableFeature(13) = "1" Then
Select Case Bg
Case "2"
BgColor = Color.Green
Case "9"
BgColor = Color.Blue
Case "c"
BgColor = Color.Red
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case "1", "4", "a"
If Strings.AvailableFeature(14) = "1" Then
Select Case Bg
Case "1"
BgColor = Color.Navy
Case "4"
BgColor = Color.Maroon
Case "a"
BgColor = Color.Lime
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case "3", "5", "6", "b", "d", "e"
If Strings.AvailableFeature(15) = "1" Then
Select Case Bg
Case "3"
BgColor = Color.Cyan
Case "5"
BgColor = Color.Magenta
Case "6"
BgColor = Color.Brown
Case "b"
BgColor = Color.Aqua
Case "d"
BgColor = Color.Fuchsia
Case "e"
BgColor = Color.Yellow
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case Else
BgColor = Color.Black
End Select
Select Case Fg
Case "0"
FgColor = Color.Black
Case "7"
FgColor = Color.Silver
Case "8"
FgColor = Color.Gray
Case "f"
FgColor = Color.White
Case "2", "9", "c"
If Strings.AvailableFeature(13) = "1" Then
Select Case Fg
Case "2"
FgColor = Color.Green
Case "9"
FgColor = Color.Blue
Case "c"
FgColor = Color.Red
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case "1", "4", "a"
If Strings.AvailableFeature(14) = "1" Then
Select Case Fg
Case "1"
FgColor = Color.Navy
Case "4"
FgColor = Color.Maroon
Case "a"
FgColor = Color.Lime
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case "3", "5", "6", "b", "d", "e"
If Strings.AvailableFeature(15) = "1" Then
Select Case Fg
Case "3"
FgColor = Color.Cyan
Case "5"
FgColor = Color.Magenta
Case "6"
FgColor = Color.Brown
Case "b"
FgColor = Color.Aqua
Case "d"
FgColor = Color.Fuchsia
Case "e"
FgColor = Color.Yellow
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "One or two colors you selected is not available."
2022-11-06 07:24:53 +00:00
End If
Case Else
FgColor = Color.White
End Select
Else
Console.TextBox1.Text = Console.TextBox1.Text & Environment.NewLine & "Color is not supported for 1-bit Color Display"
2022-11-06 07:24:53 +00:00
Select Case App
Case "terminal"
BgColor = Color.Black
FgColor = Color.White
Case "infobar"
BgColor = Color.White
FgColor = Color.Black
End Select
End If
End If
Select Case App
Case "infobar"
Console.InfoBar.BackColor = BgColor
Console.InfoBar.ForeColor = FgColor
2022-11-08 03:22:01 +00:00
Strings.ComputerInfo(6) = Bg & Fg
2022-11-06 07:24:53 +00:00
Case "terminal"
Console.TextBox1.BackColor = BgColor
Console.TextBox1.ForeColor = FgColor
2022-11-08 03:22:01 +00:00
Strings.ComputerInfo(5) = Bg & Fg
2022-11-06 07:24:53 +00:00
End Select
End Sub
End Module