Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a simple Palette Builder
#1
Needed a palette editor for another 256 color mode program screen so I wrote this program.  This makes use of dialog commands, the mouse, and simple keyboard commands.  Loads and save the palette files as a simple data file. Also saves out the palette as lines of basic code.   

EDIT: added commands to copy and paste individual colors cells.

Code: (Select All)
'Palette_Builder
'by James D. Jarvis , Feb 2/1/2023
'
'a simple 256 color palette builder for QB64 PE
' saves and loads simple palette data files or basic source code to build a palette
Dim klr(0 To 255) As _Unsigned Long
Dim tklr As _Unsigned Long
Screen _NewImage(1100, 400, 256)
_Title "Palette_Builder"
Dim Shared showpalnos
showpalnos = 0
klr(0) = _RGB32(0, 0, 0)
klr(1) = _RGB32(0, 0, 255)
klr(2) = _RGB32(0, 128, 0)
klr(3) = _RGB32(0, 217, 217)
klr(4) = _RGB32(255, 0, 0)
klr(5) = _RGB32(193, 0, 193)
klr(6) = _RGB32(149, 5, 5)
klr(7) = _RGB32(192, 192, 192)
klr(8) = _RGB32(100, 100, 100)
klr(9) = _RGB32(0, 128, 255)
klr(10) = _RGB32(128, 255, 128)
klr(11) = _RGB32(128, 255, 255)
klr(12) = _RGB32(255, 128, 0)
klr(13) = _RGB32(255, 128, 255)
klr(14) = _RGB32(255, 255, 128)
klr(15) = _RGB32(250, 250, 250)
klr(255) = _RGB32(250, 250, 250)
For k = 16 To 254
    klr(k) = _RGB32(k, Int(k * .8), Int(k * .4))
Next k
klr(101) = _RGB32(100, 100, 100)
For k = 16 To 255
    _PaletteColor k, klr(k)
Next k
Color 255, 0
drawgrid

Do
    _Limit 500
    kk$ = InKey$
    Mouser mx, my, mb
    If mb = -1 And lb = 0 Then 'open color dialog on left button mouse click over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            Line (10, 310)-(800, 340), klr(0), BF
            pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
            _PrintString (10, 312), pm$
        End If
    End If
    If mb = 0 And lb = -2 Then 'open color dialog on right button mouse release over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            If pk > -1 And pk < 256 Then
                klr(pk) = _ColorChooserDialog("Choose Color", _RGB32(_Red32(klr(pk)), _Green32(klr(pk)), _Blue32(klr(pk))))
                _PaletteColor pk, klr(pk)
            End If
        End If
    End If
    lb = mb 'record mouse button just clicked as last button clicked
    Select Case kk$
        Case "s", "S" 'save palette
            savefile$ = _SaveFileDialog$("Save File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                For k = 0 To 255
                    Print #1, klr(k)
                Next k
                Close #1
            End If
        Case "l", "L" 'load palette
            loadfile$ = _OpenFileDialog$("Open File", "", "*.*", "*.*", -1)
            If loadfile$ <> "" Then
                _MessageBox "Information", "You selected " + loadfile$
                k = 0
                Open loadfile$ For Input As #1
                Do Until EOF(1)
                    Input #1, klr(k)
                    _PaletteColor k, klr(k)
                    k = k + 1
                Loop
                Close #1
                drawgrid
            End If
        Case "b", "B" 'save basic code for palette to a file
            savefile$ = _SaveFileDialog$("Save Basic Code to File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                Print #1, "'256 color palette uncomment lines as needed for use"
                Print #1, "'Screen _NewImage(600, 400,256) "
                Print #1, "'dim shared klr(0 to 255) as _unsigned long"
                For k = 0 To 255
                    bc$ = ""
                    bc$ = "klr(" + _Trim$(Str$(k)) + ") = _rgb32(" + _Trim$(Str$(_Red32(klr(k)))) + "," + _Trim$(Str$(_Green32(klr(k)))) + "," + _Trim$(Str$(_Blue32(klr(k)))) + ")"
                    Print #1, bc$
                Next k
                Print #1, "'For k = 0 To 255 "
                Print #1, "' _PaletteColor k, klr(k) "
                Print #1, "' Next k"
                Close #1
            End If
        Case "n", "N" 'toggle display of color numbers on palette grid
            If showpalnos = 0 Then showpalnos = 1 Else showpalnos = 0
            drawgrid
        Case "c", "C"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                Line (10, 310)-(800, 340), klr(0), BF
                pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
                _PrintString (10, 312), pm$
                If pk > 0 And pk < 256 Then tklr = klr(pk)
            End If
        Case "p", "P"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                If pk > 0 And pk < 256 Then klr(pk) = tklr
                _PaletteColor pk, klr(pk)
            End If


    End Select
Loop Until kk$ = Chr$(27)
System

'draw the palette grid
Sub drawgrid
    _PrintMode _KeepBackground
    For y = 0 To 7
        For x = 0 To 31
            yy = y * 32
            xx = x * 16
            dk = yy + x
            xx = xx * 2
            Line (xx, yy)-(xx + 30, yy + 30), dk, BF
            If showpalnos = 1 Then
                _PrintString (xx + 2, yy + 6), _Trim$(Str$(dk))
            End If
    Next x, y
    _PrintString (10, 257), "S - Save File   L - Load File   B - Save Basic Code  N - show color #'s <ESC> -QUIT "
    _PrintString (10, 275), "Left Click - show RGB values    Right Click - change RGB values "
    _PrintString (10, 293), "C - Copy color    P - Paste color"
End Sub
'mouse sub from wiki with added check for mouse(2)
Sub Mouser (x, y, b)
    mi = _MouseInput
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub
Reply
#2
this version has an embedded default palette that is a little more interesting than that created in the earlier version. 

Code: (Select All)
'Palette_Builder03
'by James D. Jarvis , Feb 2/1/2023
'
'a simple 256 color palette builder for QB64PE
' saves and loads simple palette data files or basic source code to build a palette
'defaultpal loads an embedded default palette
Dim Shared klr(0 To 255) As _Unsigned Long
Dim tklr As _Unsigned Long
Screen _NewImage(1100, 400, 256)
_Title "Palette_Builder"
Dim Shared showpalnos
showpalnos = 0
defaultpal
Color 255, 0
drawgrid

Do
    _Limit 500
    kk$ = InKey$
    Mouser mx, my, mb
    If mb = -1 And lb = 0 Then 'open color dialog on left button mouse click over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            Line (10, 310)-(800, 340), klr(0), BF
            pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
            _PrintString (10, 312), pm$
        End If
    End If
    If mb = 0 And lb = -2 Then 'open color dialog on right button mouse release over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            If pk > -1 And pk < 256 Then
                klr(pk) = _ColorChooserDialog("Choose Color", _RGB32(_Red32(klr(pk)), _Green32(klr(pk)), _Blue32(klr(pk))))
                'klr(pk) = _ColorChooserDialog("Choose Color", pk)
                _PaletteColor pk, klr(pk)
            End If
        End If
    End If
    lb = mb 'record mouse button just clicked as last button clicked
    Select Case kk$
        Case "s", "S" 'save palette
            savefile$ = _SaveFileDialog$("Save File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                For k = 0 To 255
                    Print #1, klr(k)
                Next k
                Close #1
            End If
        Case "l", "L" 'load palette
            loadfile$ = _OpenFileDialog$("Open File", "", "*.*", "*.*", -1)
            If loadfile$ <> "" Then
                _MessageBox "Information", "You selected " + loadfile$
                k = 0
                Open loadfile$ For Input As #1
                Do Until EOF(1)
                    Input #1, klr(k)
                    _PaletteColor k, klr(k)
                    k = k + 1
                Loop
                Close #1
                drawgrid
            End If
        Case "b", "B" 'save basic code for palette to a file
            savefile$ = _SaveFileDialog$("Save Basic Code to File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                Print #1, "'256 color palette uncomment lines as needed for use"
                Print #1, "'Screen _NewImage(600, 400,256) "
                Print #1, "'dim shared klr(0 to 255) as _unsigned long"
                For k = 0 To 255
                    bc$ = ""
                    bc$ = "klr(" + _Trim$(Str$(k)) + ") = _rgb32(" + _Trim$(Str$(_Red32(klr(k)))) + "," + _Trim$(Str$(_Green32(klr(k)))) + "," + _Trim$(Str$(_Blue32(klr(k)))) + ")"
                    Print #1, bc$
                Next k
                Print #1, "'For k = 0 To 255 "
                Print #1, "' _PaletteColor k, klr(k) "
                Print #1, "' Next k"
                Close #1
            End If
        Case "n", "N" 'toggle display of color numbers on palette grid
            If showpalnos = 0 Then showpalnos = 1 Else showpalnos = 0
            drawgrid
        Case "c", "C"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                Line (10, 310)-(800, 340), klr(0), BF
                pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
                _PrintString (10, 312), pm$
                If pk > 0 And pk < 256 Then tklr = klr(pk)
            End If
        Case "p", "P"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                If pk > 0 And pk < 256 Then klr(pk) = tklr
                _PaletteColor pk, klr(pk)
            End If


    End Select
Loop Until kk$ = Chr$(27)
System

'draw the palette grid
Sub drawgrid
    _PrintMode _KeepBackground
    For y = 0 To 7
        For x = 0 To 31
            yy = y * 32
            xx = x * 16
            dk = yy + x
            xx = xx * 2
            Line (xx, yy)-(xx + 30, yy + 30), dk, BF
            If showpalnos = 1 Then
                _PrintString (xx + 2, yy + 6), _Trim$(Str$(dk))
            End If
    Next x, y
    _PrintString (10, 257), "S - Save File   L - Load File   B - Save Basic Code  N - show color #'s <ESC> -QUIT "
    _PrintString (10, 275), "Left Click - show RGB values    Right Click - change RGB values "
    _PrintString (10, 293), "C - Copy color    P - Paste color"
End Sub
'mouse sub from wiki with added check for mouse(2)
Sub Mouser (x, y, b)
    mi = _MouseInput
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub

Sub defaultpal
    'a default 256 color palette
    klr(0) = _RGB32(0, 0, 0)
    klr(1) = _RGB32(0, 0, 200)
    klr(2) = _RGB32(0, 80, 0)
    klr(3) = _RGB32(0, 217, 217)
    klr(4) = _RGB32(255, 0, 0)
    klr(5) = _RGB32(193, 0, 193)
    klr(6) = _RGB32(149, 5, 5)
    klr(7) = _RGB32(192, 192, 192)
    klr(8) = _RGB32(100, 100, 100)
    klr(9) = _RGB32(0, 128, 255)
    klr(10) = _RGB32(128, 255, 128)
    klr(11) = _RGB32(120, 240, 255)
    klr(12) = _RGB32(255, 128, 0)
    klr(13) = _RGB32(235, 150, 235)
    klr(14) = _RGB32(255, 255, 0)
    klr(15) = _RGB32(235, 235, 235)
    klr(16) = _RGB32(16, 12, 6)
    klr(17) = _RGB32(30, 24, 12)
    klr(18) = _RGB32(12, 16, 6)
    klr(19) = _RGB32(24, 30, 12)
    klr(20) = _RGB32(12, 6, 16)
    klr(21) = _RGB32(16, 6, 12)
    klr(22) = _RGB32(36, 12, 12)
    klr(23) = _RGB32(95, 60, 30)
    klr(24) = _RGB32(97, 70, 52)
    klr(25) = _RGB32(113, 56, 0)
    klr(26) = _RGB32(160, 160, 150)
    klr(27) = _RGB32(240, 240, 142)
    klr(28) = _RGB32(50, 0, 0)
    klr(29) = _RGB32(0, 50, 0)
    klr(30) = _RGB32(0, 0, 50)
    klr(31) = _RGB32(130, 125, 120)
    klr(32) = _RGB32(10, 10, 10)
    klr(33) = _RGB32(0, 0, 210)
    klr(34) = _RGB32(0, 100, 0)
    klr(35) = _RGB32(15, 217, 217)
    klr(36) = _RGB32(255, 15, 15)
    klr(37) = _RGB32(193, 15, 193)
    klr(38) = _RGB32(149, 20, 20)
    klr(39) = _RGB32(199, 199, 199)
    klr(40) = _RGB32(110, 110, 110)
    klr(41) = _RGB32(15, 128, 255)
    klr(42) = _RGB32(132, 255, 132)
    klr(43) = _RGB32(140, 240, 255)
    klr(44) = _RGB32(255, 128, 32)
    klr(45) = _RGB32(240, 155, 240)
    klr(46) = _RGB32(255, 255, 40)
    klr(47) = _RGB32(240, 240, 240)
    klr(48) = _RGB32(48, 38, 19)
    klr(49) = _RGB32(49, 39, 19)
    klr(50) = _RGB32(38, 48, 19)
    klr(51) = _RGB32(39, 49, 19)
    klr(52) = _RGB32(38, 19, 48)
    klr(53) = _RGB32(48, 19, 38)
    klr(54) = _RGB32(48, 18, 18)
    klr(55) = _RGB32(115, 73, 32)
    klr(56) = _RGB32(132, 96, 72)
    klr(57) = _RGB32(183, 91, 0)
    klr(58) = _RGB32(170, 170, 150)
    klr(59) = _RGB32(245, 245, 154)
    klr(60) = _RGB32(60, 0, 0)
    klr(61) = _RGB32(0, 60, 0)
    klr(62) = _RGB32(0, 0, 60)
    klr(63) = _RGB32(110, 125, 135)
    klr(64) = _RGB32(20, 20, 20)
    klr(65) = _RGB32(0, 0, 220)
    klr(66) = _RGB32(0, 120, 0)
    klr(67) = _RGB32(30, 217, 217)
    klr(68) = _RGB32(255, 30, 30)
    klr(69) = _RGB32(193, 30, 193)
    klr(70) = _RGB32(149, 40, 40)
    klr(71) = _RGB32(204, 204, 204)
    klr(72) = _RGB32(120, 120, 120)
    klr(73) = _RGB32(30, 128, 255)
    klr(74) = _RGB32(136, 255, 136)
    klr(75) = _RGB32(160, 240, 255)
    klr(76) = _RGB32(255, 128, 64)
    klr(77) = _RGB32(245, 160, 245)
    klr(78) = _RGB32(255, 255, 80)
    klr(79) = _RGB32(245, 245, 245)
    klr(80) = _RGB32(80, 64, 32)
    klr(81) = _RGB32(94, 75, 37)
    klr(82) = _RGB32(64, 80, 32)
    klr(83) = _RGB32(75, 94, 37)
    klr(84) = _RGB32(64, 32, 80)
    klr(85) = _RGB32(80, 32, 64)
    klr(86) = _RGB32(60, 24, 24)
    klr(87) = _RGB32(125, 83, 33)
    klr(88) = _RGB32(165, 120, 90)
    klr(89) = _RGB32(236, 118, 0)
    klr(90) = _RGB32(180, 180, 150)
    klr(91) = _RGB32(250, 250, 166)
    klr(92) = _RGB32(70, 0, 0)
    klr(93) = _RGB32(0, 70, 0)
    klr(94) = _RGB32(0, 0, 70)
    klr(95) = _RGB32(200, 150, 200)
    klr(96) = _RGB32(30, 30, 30)
    klr(97) = _RGB32(0, 0, 230)
    klr(98) = _RGB32(0, 140, 0)
    klr(99) = _RGB32(60, 217, 217)
    klr(100) = _RGB32(255, 60, 60)
    klr(101) = _RGB32(193, 60, 193)
    klr(102) = _RGB32(149, 60, 60)
    klr(103) = _RGB32(208, 208, 208)
    klr(104) = _RGB32(140, 140, 140)
    klr(105) = _RGB32(45, 128, 255)
    klr(106) = _RGB32(140, 255, 140)
    klr(107) = _RGB32(180, 240, 255)
    klr(108) = _RGB32(255, 128, 96)
    klr(109) = _RGB32(250, 160, 250)
    klr(110) = _RGB32(255, 255, 100)
    klr(111) = _RGB32(250, 245, 245)
    klr(112) = _RGB32(112, 89, 44)
    klr(113) = _RGB32(126, 100, 50)
    klr(114) = _RGB32(89, 112, 44)
    klr(115) = _RGB32(100, 126, 50)
    klr(116) = _RGB32(89, 44, 112)
    klr(117) = _RGB32(112, 44, 89)
    klr(118) = _RGB32(72, 30, 30)
    klr(119) = _RGB32(135, 93, 35)
    klr(120) = _RGB32(192, 156, 135)
    klr(121) = _RGB32(255, 154, 53)
    klr(122) = _RGB32(195, 195, 150)
    klr(123) = _RGB32(255, 255, 178)
    klr(124) = _RGB32(80, 0, 0)
    klr(125) = _RGB32(0, 80, 0)
    klr(126) = _RGB32(0, 0, 80)
    klr(127) = _RGB32(200, 200, 150)
    klr(128) = _RGB32(40, 40, 40)
    klr(129) = _RGB32(0, 0, 240)
    klr(130) = _RGB32(0, 160, 0)
    klr(131) = _RGB32(90, 217, 217)
    klr(132) = _RGB32(255, 90, 90)
    klr(133) = _RGB32(193, 90, 193)
    klr(134) = _RGB32(149, 80, 80)
    klr(135) = _RGB32(212, 212, 212)
    klr(136) = _RGB32(150, 150, 150)
    klr(137) = _RGB32(60, 128, 255)
    klr(138) = _RGB32(150, 255, 150)
    klr(139) = _RGB32(190, 240, 255)
    klr(140) = _RGB32(255, 128, 128)
    klr(141) = _RGB32(250, 170, 250)
    klr(142) = _RGB32(255, 255, 110)
    klr(143) = _RGB32(250, 250, 245)
    klr(144) = _RGB32(144, 115, 57)
    klr(145) = _RGB32(158, 126, 63)
    klr(146) = _RGB32(115, 144, 57)
    klr(147) = _RGB32(126, 158, 63)
    klr(148) = _RGB32(115, 57, 144)
    klr(149) = _RGB32(144, 57, 115)
    klr(150) = _RGB32(84, 36, 36)
    klr(151) = _RGB32(140, 98, 32)
    klr(152) = _RGB32(204, 175, 157)
    klr(153) = _RGB32(255, 177, 100)
    klr(154) = _RGB32(210, 210, 150)
    klr(155) = _RGB32(255, 255, 190)
    klr(156) = _RGB32(90, 0, 0)
    klr(157) = _RGB32(0, 90, 0)
    klr(158) = _RGB32(0, 0, 90)
    klr(159) = _RGB32(200, 200, 200)
    klr(160) = _RGB32(50, 50, 50)
    klr(161) = _RGB32(0, 0, 250)
    klr(162) = _RGB32(0, 180, 0)
    klr(163) = _RGB32(120, 217, 217)
    klr(164) = _RGB32(255, 120, 120)
    klr(165) = _RGB32(193, 120, 193)
    klr(166) = _RGB32(149, 100, 100)
    klr(167) = _RGB32(216, 216, 216)
    klr(168) = _RGB32(160, 160, 160)
    klr(169) = _RGB32(75, 128, 255)
    klr(170) = _RGB32(160, 255, 160)
    klr(171) = _RGB32(200, 250, 255)
    klr(172) = _RGB32(255, 136, 136)
    klr(173) = _RGB32(250, 180, 250)
    klr(174) = _RGB32(255, 255, 120)
    klr(175) = _RGB32(250, 250, 250)
    klr(176) = _RGB32(176, 140, 70)
    klr(177) = _RGB32(190, 152, 76)
    klr(178) = _RGB32(140, 176, 70)
    klr(179) = _RGB32(152, 190, 76)
    klr(180) = _RGB32(140, 70, 176)
    klr(181) = _RGB32(176, 70, 140)
    klr(182) = _RGB32(96, 40, 40)
    klr(183) = _RGB32(150, 108, 40)
    klr(184) = _RGB32(217, 196, 183)
    klr(185) = _RGB32(255, 192, 130)
    klr(186) = _RGB32(225, 225, 150)
    klr(187) = _RGB32(255, 255, 202)
    klr(188) = _RGB32(100, 0, 0)
    klr(189) = _RGB32(0, 100, 0)
    klr(190) = _RGB32(0, 0, 100)
    klr(191) = _RGB32(250, 200, 200)
    klr(192) = _RGB32(60, 60, 60)
    klr(193) = _RGB32(20, 20, 250)
    klr(194) = _RGB32(0, 200, 0)
    klr(195) = _RGB32(150, 217, 217)
    klr(196) = _RGB32(255, 150, 150)
    klr(197) = _RGB32(193, 150, 193)
    klr(198) = _RGB32(149, 120, 120)
    klr(199) = _RGB32(228, 228, 228)
    klr(200) = _RGB32(170, 170, 170)
    klr(201) = _RGB32(90, 128, 255)
    klr(202) = _RGB32(170, 255, 170)
    klr(203) = _RGB32(200, 255, 255)
    klr(204) = _RGB32(255, 148, 148)
    klr(205) = _RGB32(255, 185, 255)
    klr(206) = _RGB32(255, 255, 140)
    klr(207) = _RGB32(255, 250, 250)
    klr(208) = _RGB32(208, 166, 83)
    klr(209) = _RGB32(222, 177, 88)
    klr(210) = _RGB32(166, 208, 83)
    klr(211) = _RGB32(177, 222, 88)
    klr(212) = _RGB32(166, 83, 208)
    klr(213) = _RGB32(208, 83, 166)
    klr(214) = _RGB32(108, 44, 44)
    klr(215) = _RGB32(155, 113, 44)
    klr(216) = _RGB32(223, 206, 196)
    klr(217) = _RGB32(255, 220, 185)
    klr(218) = _RGB32(240, 240, 150)
    klr(219) = _RGB32(255, 255, 234)
    klr(220) = _RGB32(120, 0, 0)
    klr(221) = _RGB32(0, 120, 0)
    klr(222) = _RGB32(0, 0, 120)
    klr(223) = _RGB32(250, 250, 200)
    klr(224) = _RGB32(70, 70, 70)
    klr(225) = _RGB32(40, 40, 250)
    klr(226) = _RGB32(0, 220, 0)
    klr(227) = _RGB32(150, 217, 217)
    klr(228) = _RGB32(255, 180, 180)
    klr(229) = _RGB32(193, 180, 193)
    klr(230) = _RGB32(149, 140, 140)
    klr(231) = _RGB32(240, 240, 236)
    klr(232) = _RGB32(180, 180, 180)
    klr(233) = _RGB32(115, 128, 255)
    klr(234) = _RGB32(190, 255, 190)
    klr(235) = _RGB32(220, 255, 255)
    klr(236) = _RGB32(255, 160, 160)
    klr(237) = _RGB32(255, 200, 255)
    klr(238) = _RGB32(255, 255, 160)
    klr(239) = _RGB32(255, 255, 250)
    klr(240) = _RGB32(240, 192, 96)
    klr(241) = _RGB32(254, 203, 101)
    klr(242) = _RGB32(192, 240, 96)
    klr(243) = _RGB32(203, 254, 101)
    klr(244) = _RGB32(192, 96, 240)
    klr(245) = _RGB32(240, 96, 192)
    klr(246) = _RGB32(120, 48, 48)
    klr(247) = _RGB32(165, 120, 45)
    klr(248) = _RGB32(227, 214, 204)
    klr(249) = _RGB32(255, 235, 195)
    klr(250) = _RGB32(255, 255, 150)
    klr(251) = _RGB32(255, 255, 249)
    klr(252) = _RGB32(140, 0, 0)
    klr(253) = _RGB32(0, 140, 0)
    klr(254) = _RGB32(0, 0, 140)
    klr(255) = _RGB32(250, 250, 250)
    For k = 0 To 255
        _PaletteColor k, klr(k)
    Next k

End Sub
Reply
#3
Quote:
Code: (Select All)
'mouse sub from wiki with added check for mouse(2)
Sub Mouser (x, y, b)
    mi = _MouseInput
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub

I am curious where in wiki this is? Might need to be fixed.

Your Mouser routine seems to work only because it's being used in a loop with _Limit 500

If you try that routine in a _Limit 60 or less loop you will want to change Mouser to:
Code: (Select All)
Sub Mouser (x, y, b)
    While _MouseInput: Wend
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub
b = b + ...
Reply
#4
Here's my goto 256 color palette routines:

Code: (Select All)
CONST Black = 0~%%
CONST Blue = 1~%%
CONST Green = 2~%%
CONST Cyan = 3~%%
CONST Red = 4~%%
CONST Magenta = 5~%%
CONST Brown = 6~%%
CONST White = 7~%%
CONST Gray = 8~%%
CONST LightBlue = 9~%%
CONST LightGreen = 10~%%
CONST LightCyan = 11~%%
CONST LightRed = 12~%%
CONST LightMagenta = 13~%%
CONST Yellow = 14~%%
CONST BrightWhite = 15~%%
CONST AliceBlue = 16~%%
CONST Almond = 17~%%
CONST AntiqueBrass = 18~%%
CONST AntiqueWhite = 19~%%
CONST Apricot = 20~%%
CONST Aqua = 21~%%
CONST Aquamarine = 22~%%
CONST Asparagus = 23~%%
CONST AtomicTangerine = 24~%%
CONST Azure = 25~%%
CONST BananaMania = 26~%%
CONST Beaver = 27~%%
CONST Beige = 28~%%
CONST Bisque = 29~%%
CONST Bittersweet = 30~%%
CONST BlanchedAlmond = 31~%%
CONST BlizzardBlue = 32~%%
CONST BlueBell = 33~%%
CONST BlueGray = 34~%%
CONST BlueGreen = 35~%%
CONST BlueViolet = 36~%%
CONST Blush = 37~%%
CONST BrickRed = 38~%%
CONST BurlyWood = 39~%%
CONST BurntOrange = 40~%%
CONST BurntSienna = 41~%%
CONST CadetBlue = 42~%%
CONST Canary = 43~%%
CONST CaribbeanGreen = 44~%%
CONST CarnationPink = 45~%%
CONST Cerise = 46~%%
CONST Cerulean = 47~%%
CONST ChartReuse = 48~%%
CONST Chestnut = 49~%%
CONST Chocolate = 50~%%
CONST Copper = 51~%%
CONST Coral = 52~%%
CONST Cornflower = 53~%%
CONST CornflowerBlue = 54~%%
CONST Cornsilk = 55~%%
CONST CottonCandy = 56~%%
CONST Crimson = 57~%%
CONST Dandelion = 58~%%
CONST DarkBlue = 59~%%
CONST DarkCyan = 60~%%
CONST DarkGoldenRod = 61~%%
CONST DarkGray = 62~%%
CONST DarkGreen = 63~%%
CONST DarkKhaki = 64~%%
CONST DarkMagenta = 65~%%
CONST DarkOliveGreen = 66~%%
CONST DarkOrange = 67~%%
CONST DarkOrchid = 68~%%
CONST DarkRed = 69~%%
CONST DarkSalmon = 70~%%
CONST DarkSeaGreen = 71~%%
CONST DarkSlateBlue = 72~%%
CONST DarkSlateGray = 73~%%
CONST DarkTurquoise = 74~%%
CONST DarkViolet = 75~%%
CONST DeepPink = 76~%%
CONST DeepSkyBlue = 77~%%
CONST Denim = 78~%%
CONST DesertSand = 79~%%
CONST DimGray = 80~%%
CONST DodgerBlue = 81~%%
CONST Eggplant = 82~%%
CONST ElectricLime = 83~%%
CONST Fern = 84~%%
CONST FireBrick = 85~%%
CONST Floralwhite = 86~%%
CONST ForestGreen = 87~%%
CONST Fuchsia = 88~%%
CONST FuzzyWuzzy = 89~%%
CONST Gainsboro = 90~%%
CONST GhostWhite = 91~%%
CONST Gold = 92~%%
CONST GoldenRod = 93~%%
CONST GrannySmithApple = 94~%%
CONST GreenBlue = 95~%%
CONST GreenYellow = 96~%%
CONST HoneyDew = 97~%%
CONST HotMagenta = 98~%%
CONST HotPink = 99~%%
CONST Inchworm = 100~%%
CONST IndianRed = 101~%%
CONST Indigo = 102~%%
CONST Ivory = 103~%%
CONST JazzberryJam = 104~%%
CONST JungleGreen = 105~%%
CONST Khaki = 106~%%
CONST LaserLemon = 107~%%
CONST Lavender = 108~%%
CONST LavenderBlush = 109~%%
CONST LawnGreen = 110~%%
CONST LemonChiffon = 111~%%
CONST LemonYellow = 112~%%
CONST LightCoral = 113~%%
CONST LightGoldenRodYellow = 114~%%
CONST LightGray = 115~%%
CONST LightGreen2 = 116~%%
CONST LightPink = 117~%%
CONST LightSalmon = 118~%%
CONST LightSeaGreen = 119~%%
CONST LightSkyBlue = 120~%%
CONST LightSlateGray = 121~%%
CONST LightSteelBlue = 122~%%
CONST LightYellow = 123~%%
CONST Lime = 124~%%
CONST LimeGreen = 125~%%
CONST Linen = 126~%%
CONST MacaroniAndCheese = 127~%%
CONST MagicMint = 128~%%
CONST Mahogany = 129~%%
CONST Maize = 130~%%
CONST Manatee = 131~%%
CONST MangoTango = 132~%%
CONST Maroon = 133~%%
CONST Mauvelous = 134~%%
CONST MediumAquamarine = 135~%%
CONST MediumBlue = 136~%%
CONST MediumOrchid = 137~%%
CONST MediumPurple = 138~%%
CONST MediumSeaGreen = 139~%%
CONST MediumSlateBlue = 140~%%
CONST MediumSpringGreen = 141~%%
CONST MediumTurquoise = 142~%%
CONST MediumVioletRed = 143~%%
CONST Melon = 144~%%
CONST MidnightBlue = 145~%%
CONST MintCream = 146~%%
CONST MistyRose = 147~%%
CONST Moccasin = 148~%%
CONST MountainMeadow = 149~%%
CONST Mulberry = 150~%%
CONST NavajoWhite = 151~%%
CONST Navy = 152~%%
CONST NavyBlue = 153~%%
CONST NeonCarrot = 154~%%
CONST OldLace = 155~%%
CONST Olive = 156~%%
CONST OliveDrab = 157~%%
CONST OliveGreen = 158~%%
CONST Orange = 159~%%
CONST OrangeRed = 160~%%
CONST OrangeYellow = 161~%%
CONST Orchid = 162~%%
CONST OuterSpace = 163~%%
CONST OutrageousOrange = 164~%%
CONST PacificBlue = 165~%%
CONST PaleGoldenRod = 166~%%
CONST PaleGreen = 167~%%
CONST PaleTurquoise = 168~%%
CONST PaleVioletRed = 169~%%
CONST PapayaWhip = 170~%%
CONST Peach = 171~%%
CONST PeachPuff = 172~%%
CONST Periwinkle = 173~%%
CONST Peru = 174~%%
CONST PiggyPink = 175~%%
CONST PineGreen = 176~%%
CONST Pink = 177~%%
CONST PinkFlamingo = 178~%%
CONST PinkSherbet = 179~%%
CONST Plum = 180~%%
CONST PowderBlue = 181~%%
CONST Purple = 182~%%
CONST PurpleHeart = 183~%%
CONST PurpleMountainsMajesty = 184~%%
CONST PurplePizzazz = 185~%%
CONST RadicalRed = 186~%%
CONST RawSienna = 187~%%
CONST RawUmber = 188~%%
CONST RazzleDazzleRose = 189~%%
CONST Razzmatazz = 190~%%
CONST RedOrange = 191~%%
CONST RedViolet = 192~%%
CONST RobinsEggBlue = 193~%%
CONST RosyBrown = 194~%%
CONST RoyalBlue = 195~%%
CONST RoyalPurple = 196~%%
CONST SaddleBrown = 197~%%
CONST Salmon = 198~%%
CONST SandyBrown = 199~%%
CONST Scarlet = 200~%%
CONST ScreaminGreen = 201~%%
CONST SeaGreen = 202~%%
CONST SeaShell = 203~%%
CONST Sepia = 204~%%
CONST Shadow = 205~%%
CONST Shamrock = 206~%%
CONST ShockingPink = 207~%%
CONST Sienna = 208~%%
CONST Silver = 209~%%
CONST SkyBlue = 210~%%
CONST SlateBlue = 211~%%
CONST SlateGray = 212~%%
CONST Snow = 213~%%
CONST SpringGreen = 214~%%
CONST SteelBlue = 215~%%
CONST Sunglow = 216~%%
CONST SunsetOrange = 217~%%
CONST Tann = 218~%%
CONST Teal = 219~%%
CONST TealBlue = 220~%%
CONST Thistle = 221~%%
CONST TickleMePink = 222~%%
CONST Timberwolf = 223~%%
CONST Tomato = 224~%%
CONST TropicalRainForest = 225~%%
CONST Tumbleweed = 226~%%
CONST Turquoise = 227~%%
CONST TurquoiseBlue = 228~%%
CONST UnmellowYellow = 229~%%
CONST Violet = 230~%%
CONST VioletBlue = 231~%%
CONST VioletRed = 232~%%
CONST VividTangerine = 233~%%
CONST VividViolet = 234~%%
CONST Wheat = 235~%%
CONST Whitesmoke = 236~%%
CONST WildBlueYonder = 237~%%
CONST WildStrawberry = 238~%%
CONST WildWatermelon = 239~%%
CONST Wisteria = 240~%%
CONST YellowGreen = 241~%%
CONST YellowOrange = 242~%%


SCREEN _NEWIMAGE(800, 600, 256)
Set256Palette _DISPLAY

LINE (100, 100)-(200, 200), Silver, BF
LINE (200, 100)-(300, 200), Gold, BF
LINE (300, 100)-(400, 200), Peach, BF
LINE (400, 100)-(500, 200), SkyBlue, BF







SUB Set256Palette (handle)
    D = _DEST: S = _SOURCE
    _DEST handle: _SOURCE handle
    _PALETTECOLOR 16, _RGBA32(240, 248, 255, 255)
    _PALETTECOLOR 17, _RGBA32(239, 222, 205, 255)
    _PALETTECOLOR 18, _RGBA32(205, 149, 117, 255)
    _PALETTECOLOR 19, _RGBA32(250, 235, 215, 255)
    _PALETTECOLOR 20, _RGBA32(253, 217, 181, 255)
    _PALETTECOLOR 21, _RGBA32(0, 255, 255, 255)
    _PALETTECOLOR 22, _RGBA32(127, 255, 212, 255)
    _PALETTECOLOR 23, _RGBA32(135, 169, 107, 255)
    _PALETTECOLOR 24, _RGBA32(255, 164, 116, 255)
    _PALETTECOLOR 25, _RGBA32(240, 255, 255, 255)
    _PALETTECOLOR 26, _RGBA32(250, 231, 181, 255)
    _PALETTECOLOR 27, _RGBA32(159, 129, 112, 255)
    _PALETTECOLOR 28, _RGBA32(245, 245, 220, 255)
    _PALETTECOLOR 29, _RGBA32(255, 228, 196, 255)
    _PALETTECOLOR 30, _RGBA32(253, 124, 110, 255)
    _PALETTECOLOR 31, _RGBA32(255, 235, 205, 255)
    _PALETTECOLOR 32, _RGBA32(172, 229, 238, 255)
    _PALETTECOLOR 33, _RGBA32(162, 162, 208, 255)
    _PALETTECOLOR 34, _RGBA32(102, 153, 204, 255)
    _PALETTECOLOR 35, _RGBA32(13, 152, 186, 255)
    _PALETTECOLOR 36, _RGBA32(138, 43, 226, 255)
    _PALETTECOLOR 37, _RGBA32(222, 93, 131, 255)
    _PALETTECOLOR 38, _RGBA32(203, 65, 84, 255)
    _PALETTECOLOR 39, _RGBA32(222, 184, 135, 255)
    _PALETTECOLOR 40, _RGBA32(255, 127, 73, 255)
    _PALETTECOLOR 41, _RGBA32(234, 126, 93, 255)
    _PALETTECOLOR 42, _RGBA32(95, 158, 160, 255)
    _PALETTECOLOR 43, _RGBA32(255, 255, 153, 255)
    _PALETTECOLOR 44, _RGBA32(28, 211, 162, 255)
    _PALETTECOLOR 45, _RGBA32(255, 170, 204, 255)
    _PALETTECOLOR 46, _RGBA32(221, 68, 146, 255)
    _PALETTECOLOR 47, _RGBA32(29, 172, 214, 255)
    _PALETTECOLOR 48, _RGBA32(127, 255, 0, 255)
    _PALETTECOLOR 49, _RGBA32(188, 93, 88, 255)
    _PALETTECOLOR 50, _RGBA32(210, 105, 30, 255)
    _PALETTECOLOR 51, _RGBA32(221, 148, 117, 255)
    _PALETTECOLOR 52, _RGBA32(255, 127, 80, 255)
    _PALETTECOLOR 53, _RGBA32(154, 206, 235, 255)
    _PALETTECOLOR 54, _RGBA32(100, 149, 237, 255)
    _PALETTECOLOR 55, _RGBA32(255, 248, 220, 255)
    _PALETTECOLOR 56, _RGBA32(255, 188, 217, 255)
    _PALETTECOLOR 57, _RGBA32(220, 20, 60, 255)
    _PALETTECOLOR 58, _RGBA32(253, 219, 109, 255)
    _PALETTECOLOR 59, _RGBA32(0, 0, 139, 255)
    _PALETTECOLOR 60, _RGBA32(0, 139, 139, 255)
    _PALETTECOLOR 61, _RGBA32(184, 134, 11, 255)
    _PALETTECOLOR 62, _RGBA32(169, 169, 169, 255)
    _PALETTECOLOR 63, _RGBA32(0, 100, 0, 255)
    _PALETTECOLOR 64, _RGBA32(189, 183, 107, 255)
    _PALETTECOLOR 65, _RGBA32(139, 0, 139, 255)
    _PALETTECOLOR 66, _RGBA32(85, 107, 47, 255)
    _PALETTECOLOR 67, _RGBA32(255, 140, 0, 255)
    _PALETTECOLOR 68, _RGBA32(153, 50, 204, 255)
    _PALETTECOLOR 69, _RGBA32(139, 0, 0, 255)
    _PALETTECOLOR 70, _RGBA32(233, 150, 122, 255)
    _PALETTECOLOR 71, _RGBA32(143, 188, 143, 255)
    _PALETTECOLOR 72, _RGBA32(72, 61, 139, 255)
    _PALETTECOLOR 73, _RGBA32(47, 79, 79, 255)
    _PALETTECOLOR 74, _RGBA32(0, 206, 209, 255)
    _PALETTECOLOR 75, _RGBA32(148, 0, 211, 255)
    _PALETTECOLOR 76, _RGBA32(255, 20, 147, 255)
    _PALETTECOLOR 77, _RGBA32(0, 191, 255, 255)
    _PALETTECOLOR 78, _RGBA32(43, 108, 196, 255)
    _PALETTECOLOR 79, _RGBA32(239, 205, 184, 255)
    _PALETTECOLOR 80, _RGBA32(105, 105, 105, 255)
    _PALETTECOLOR 81, _RGBA32(30, 144, 255, 255)
    _PALETTECOLOR 82, _RGBA32(110, 81, 96, 255)
    _PALETTECOLOR 83, _RGBA32(206, 255, 29, 255)
    _PALETTECOLOR 84, _RGBA32(113, 188, 120, 255)
    _PALETTECOLOR 85, _RGBA32(178, 34, 34, 255)
    _PALETTECOLOR 86, _RGBA32(255, 250, 240, 255)
    _PALETTECOLOR 87, _RGBA32(34, 139, 34, 255)
    _PALETTECOLOR 88, _RGBA32(195, 100, 197, 255)
    _PALETTECOLOR 89, _RGBA32(204, 102, 102, 255)
    _PALETTECOLOR 90, _RGBA32(220, 220, 220, 255)
    _PALETTECOLOR 91, _RGBA32(248, 248, 255, 255)
    _PALETTECOLOR 92, _RGBA32(255, 215, 0, 255)
    _PALETTECOLOR 93, _RGBA32(218, 165, 32, 255)
    _PALETTECOLOR 94, _RGBA32(168, 228, 160, 255)
    _PALETTECOLOR 95, _RGBA32(17, 100, 180, 255)
    _PALETTECOLOR 96, _RGBA32(173, 255, 47, 255)
    _PALETTECOLOR 97, _RGBA32(240, 255, 240, 255)
    _PALETTECOLOR 98, _RGBA32(255, 29, 206, 255)
    _PALETTECOLOR 99, _RGBA32(255, 105, 180, 255)
    _PALETTECOLOR 100, _RGBA32(178, 236, 93, 255)
    _PALETTECOLOR 101, _RGBA32(205, 92, 92, 255)
    _PALETTECOLOR 102, _RGBA32(75, 0, 130, 255)
    _PALETTECOLOR 103, _RGBA32(255, 255, 240, 255)
    _PALETTECOLOR 104, _RGBA32(202, 55, 103, 255)
    _PALETTECOLOR 105, _RGBA32(59, 176, 143, 255)
    _PALETTECOLOR 106, _RGBA32(240, 230, 140, 255)
    _PALETTECOLOR 107, _RGBA32(254, 254, 34, 255)
    _PALETTECOLOR 108, _RGBA32(230, 230, 250, 255)
    _PALETTECOLOR 109, _RGBA32(255, 240, 245, 255)
    _PALETTECOLOR 110, _RGBA32(124, 252, 0, 255)
    _PALETTECOLOR 111, _RGBA32(255, 250, 205, 255)
    _PALETTECOLOR 112, _RGBA32(255, 244, 79, 255)
    _PALETTECOLOR 113, _RGBA32(240, 128, 128, 255)
    _PALETTECOLOR 114, _RGBA32(250, 250, 210, 255)
    _PALETTECOLOR 115, _RGBA32(211, 211, 211, 255)
    _PALETTECOLOR 116, _RGBA32(144, 238, 144, 255)
    _PALETTECOLOR 117, _RGBA32(255, 182, 193, 255)
    _PALETTECOLOR 118, _RGBA32(255, 160, 122, 255)
    _PALETTECOLOR 119, _RGBA32(32, 178, 170, 255)
    _PALETTECOLOR 120, _RGBA32(135, 206, 250, 255)
    _PALETTECOLOR 121, _RGBA32(119, 136, 153, 255)
    _PALETTECOLOR 122, _RGBA32(176, 196, 222, 255)
    _PALETTECOLOR 123, _RGBA32(255, 255, 224, 255)
    _PALETTECOLOR 124, _RGBA32(0, 255, 0, 255)
    _PALETTECOLOR 125, _RGBA32(50, 205, 50, 255)
    _PALETTECOLOR 126, _RGBA32(250, 240, 230, 255)
    _PALETTECOLOR 127, _RGBA32(255, 189, 136, 255)
    _PALETTECOLOR 128, _RGBA32(170, 240, 209, 255)
    _PALETTECOLOR 129, _RGBA32(205, 74, 76, 255)
    _PALETTECOLOR 130, _RGBA32(237, 209, 156, 255)
    _PALETTECOLOR 131, _RGBA32(151, 154, 170, 255)
    _PALETTECOLOR 132, _RGBA32(255, 130, 67, 255)
    _PALETTECOLOR 133, _RGBA32(128, 0, 0, 255)
    _PALETTECOLOR 134, _RGBA32(239, 152, 170, 255)
    _PALETTECOLOR 135, _RGBA32(102, 205, 170, 255)
    _PALETTECOLOR 136, _RGBA32(0, 0, 205, 255)
    _PALETTECOLOR 137, _RGBA32(186, 85, 211, 255)
    _PALETTECOLOR 138, _RGBA32(147, 112, 219, 255)
    _PALETTECOLOR 139, _RGBA32(60, 179, 113, 255)
    _PALETTECOLOR 140, _RGBA32(123, 104, 238, 255)
    _PALETTECOLOR 141, _RGBA32(0, 250, 154, 255)
    _PALETTECOLOR 142, _RGBA32(72, 209, 204, 255)
    _PALETTECOLOR 143, _RGBA32(199, 21, 133, 255)
    _PALETTECOLOR 144, _RGBA32(253, 188, 180, 255)
    _PALETTECOLOR 145, _RGBA32(25, 25, 112, 255)
    _PALETTECOLOR 146, _RGBA32(245, 255, 250, 255)
    _PALETTECOLOR 147, _RGBA32(255, 228, 225, 255)
    _PALETTECOLOR 148, _RGBA32(255, 228, 181, 255)
    _PALETTECOLOR 149, _RGBA32(48, 186, 143, 255)
    _PALETTECOLOR 150, _RGBA32(197, 75, 140, 255)
    _PALETTECOLOR 151, _RGBA32(255, 222, 173, 255)
    _PALETTECOLOR 152, _RGBA32(0, 0, 128, 255)
    _PALETTECOLOR 153, _RGBA32(25, 116, 210, 255)
    _PALETTECOLOR 154, _RGBA32(255, 163, 67, 255)
    _PALETTECOLOR 155, _RGBA32(253, 245, 230, 255)
    _PALETTECOLOR 156, _RGBA32(128, 128, 0, 255)
    _PALETTECOLOR 157, _RGBA32(107, 142, 35, 255)
    _PALETTECOLOR 158, _RGBA32(186, 184, 108, 255)
    _PALETTECOLOR 159, _RGBA32(255, 165, 0, 255)
    _PALETTECOLOR 160, _RGBA32(255, 69, 0, 255)
    _PALETTECOLOR 161, _RGBA32(248, 213, 104, 255)
    _PALETTECOLOR 162, _RGBA32(218, 112, 214, 255)
    _PALETTECOLOR 163, _RGBA32(65, 74, 76, 255)
    _PALETTECOLOR 164, _RGBA32(255, 110, 74, 255)
    _PALETTECOLOR 165, _RGBA32(28, 169, 201, 255)
    _PALETTECOLOR 166, _RGBA32(238, 232, 170, 255)
    _PALETTECOLOR 167, _RGBA32(152, 251, 152, 255)
    _PALETTECOLOR 168, _RGBA32(175, 238, 238, 255)
    _PALETTECOLOR 169, _RGBA32(219, 112, 147, 255)
    _PALETTECOLOR 170, _RGBA32(255, 239, 213, 255)
    _PALETTECOLOR 171, _RGBA32(255, 207, 171, 255)
    _PALETTECOLOR 172, _RGBA32(255, 218, 185, 255)
    _PALETTECOLOR 173, _RGBA32(197, 208, 230, 255)
    _PALETTECOLOR 174, _RGBA32(205, 133, 63, 255)
    _PALETTECOLOR 175, _RGBA32(253, 221, 230, 255)
    _PALETTECOLOR 176, _RGBA32(21, 128, 120, 255)
    _PALETTECOLOR 177, _RGBA32(255, 192, 203, 255)
    _PALETTECOLOR 178, _RGBA32(252, 116, 253, 255)
    _PALETTECOLOR 179, _RGBA32(247, 143, 167, 255)
    _PALETTECOLOR 180, _RGBA32(221, 160, 221, 255)
    _PALETTECOLOR 181, _RGBA32(176, 224, 230, 255)
    _PALETTECOLOR 182, _RGBA32(128, 0, 128, 255)
    _PALETTECOLOR 183, _RGBA32(116, 66, 200, 255)
    _PALETTECOLOR 184, _RGBA32(157, 129, 186, 255)
    _PALETTECOLOR 185, _RGBA32(254, 78, 218, 255)
    _PALETTECOLOR 186, _RGBA32(255, 73, 108, 255)
    _PALETTECOLOR 187, _RGBA32(214, 138, 89, 255)
    _PALETTECOLOR 188, _RGBA32(113, 75, 35, 255)
    _PALETTECOLOR 189, _RGBA32(255, 72, 208, 255)
    _PALETTECOLOR 190, _RGBA32(227, 37, 107, 255)
    _PALETTECOLOR 191, _RGBA32(255, 83, 73, 255)
    _PALETTECOLOR 192, _RGBA32(192, 68, 143, 255)
    _PALETTECOLOR 193, _RGBA32(31, 206, 203, 255)
    _PALETTECOLOR 194, _RGBA32(188, 143, 143, 255)
    _PALETTECOLOR 195, _RGBA32(65, 105, 225, 255)
    _PALETTECOLOR 196, _RGBA32(120, 81, 169, 255)
    _PALETTECOLOR 197, _RGBA32(139, 69, 19, 255)
    _PALETTECOLOR 198, _RGBA32(250, 128, 114, 255)
    _PALETTECOLOR 199, _RGBA32(244, 164, 96, 255)
    _PALETTECOLOR 200, _RGBA32(252, 40, 71, 255)
    _PALETTECOLOR 201, _RGBA32(118, 255, 122, 255)
    _PALETTECOLOR 202, _RGBA32(46, 139, 87, 255)
    _PALETTECOLOR 203, _RGBA32(255, 245, 238, 255)
    _PALETTECOLOR 204, _RGBA32(165, 105, 79, 255)
    _PALETTECOLOR 205, _RGBA32(138, 121, 93, 255)
    _PALETTECOLOR 206, _RGBA32(69, 206, 162, 255)
    _PALETTECOLOR 207, _RGBA32(251, 126, 253, 255)
    _PALETTECOLOR 208, _RGBA32(160, 82, 45, 255)
    _PALETTECOLOR 209, _RGBA32(192, 192, 192, 255)
    _PALETTECOLOR 210, _RGBA32(135, 206, 235, 255)
    _PALETTECOLOR 211, _RGBA32(106, 90, 205, 255)
    _PALETTECOLOR 212, _RGBA32(112, 128, 144, 255)
    _PALETTECOLOR 213, _RGBA32(255, 250, 250, 255)
    _PALETTECOLOR 214, _RGBA32(0, 255, 127, 255)
    _PALETTECOLOR 215, _RGBA32(70, 130, 180, 255)
    _PALETTECOLOR 216, _RGBA32(255, 207, 72, 255)
    _PALETTECOLOR 217, _RGBA32(253, 94, 83, 255)
    _PALETTECOLOR 218, _RGBA32(210, 180, 140, 255)
    _PALETTECOLOR 219, _RGBA32(0, 128, 128, 255)
    _PALETTECOLOR 220, _RGBA32(24, 167, 181, 255)
    _PALETTECOLOR 221, _RGBA32(216, 191, 216, 255)
    _PALETTECOLOR 222, _RGBA32(252, 137, 172, 255)
    _PALETTECOLOR 223, _RGBA32(219, 215, 210, 255)
    _PALETTECOLOR 224, _RGBA32(255, 99, 71, 255)
    _PALETTECOLOR 225, _RGBA32(23, 128, 109, 255)
    _PALETTECOLOR 226, _RGBA32(222, 170, 136, 255)
    _PALETTECOLOR 227, _RGBA32(64, 224, 208, 255)
    _PALETTECOLOR 228, _RGBA32(119, 221, 231, 255)
    _PALETTECOLOR 229, _RGBA32(255, 255, 102, 255)
    _PALETTECOLOR 230, _RGBA32(238, 130, 238, 255)
    _PALETTECOLOR 231, _RGBA32(50, 74, 178, 255)
    _PALETTECOLOR 232, _RGBA32(247, 83, 148, 255)
    _PALETTECOLOR 233, _RGBA32(255, 160, 137, 255)
    _PALETTECOLOR 234, _RGBA32(143, 80, 157, 255)
    _PALETTECOLOR 235, _RGBA32(245, 222, 179, 255)
    _PALETTECOLOR 236, _RGBA32(245, 245, 245, 255)
    _PALETTECOLOR 237, _RGBA32(162, 173, 208, 255)
    _PALETTECOLOR 238, _RGBA32(255, 67, 164, 255)
    _PALETTECOLOR 239, _RGBA32(252, 108, 133, 255)
    _PALETTECOLOR 240, _RGBA32(205, 164, 222, 255)
    _PALETTECOLOR 241, _RGBA32(154, 205, 50, 255)
    _PALETTECOLOR 242, _RGBA32(255, 174, 66, 255)
    _DEST D: _SOURCE S
END SUB


Put the CONSTs at the start of the program, and then just call the SUB to set any screen that needs the 256 color palette.  (Note that only 242 of the colors are actually named.  The remaining 13 are reserved for user-defined colors/names.)
Reply
#5
(02-02-2023, 11:11 AM)bplus Wrote:
Quote:
Code: (Select All)
'mouse sub from wiki with added check for mouse(2)
Sub Mouser (x, y, b)
    mi = _MouseInput
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub

I am curious where in wiki this is? Might need to be fixed.

Your Mouser routine seems to work only because it's being used in a loop with _Limit 500

If you try that routine in a _Limit 60 or less loop you will want to change Mouser to:
Code: (Select All)
Sub Mouser (x, y, b)
    While _MouseInput: Wend
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub


Example 4 under _mousebutton on the wiki has this subroutine:  
Code: (Select All)
SUB Mouser (x, y, b)
mi = _MOUSEINPUT
b = _MOUSEBUTTON(1)
x = _MOUSEX
y = _MOUSEY
END SUB
Reply
#6
Cleaned up the mouser sub to fit bplus's recommendations.   (I had my while:wend in the wrong spot in an earlier version none of you were unfortunate enough to see so I went with that routine from the example).

Code: (Select All)
'Palette_Builder03b
'by James D. Jarvis , Feb 2/2/2023
'
'a simple 256 color palette builder for QB64PE
' saves and loads simple palette data files or basic source code to build a palette
'defaultpal loads an embedded default palette
Dim Shared klr(0 To 255) As _Unsigned Long
Dim tklr As _Unsigned Long
Screen _NewImage(1100, 400, 256)
_Title "Palette_Builder"
Dim Shared showpalnos
showpalnos = 0
defaultpal
Color 255, 0
drawgrid

Do
    _Limit 60
    kk$ = InKey$
    Mouser mx, my, mb
    If mb = -1 And lb = 0 Then 'open color dialog on left button mouse click over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            Line (10, 310)-(800, 340), klr(0), BF
            pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
            _PrintString (10, 312), pm$
        End If
    End If
    If mb = 0 And lb = -2 Then 'open color dialog on right button mouse release over grid position for color
        If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
            px = mx \ 32
            py = my \ 32
            pk = py * 32 + px
            If pk > -1 And pk < 256 Then
                klr(pk) = _ColorChooserDialog("Choose Color", _RGB32(_Red32(klr(pk)), _Green32(klr(pk)), _Blue32(klr(pk))))
                'klr(pk) = _ColorChooserDialog("Choose Color", pk)
                _PaletteColor pk, klr(pk)
            End If
        End If
    End If
    lb = mb 'record mouse button just clicked as last button clicked
    Select Case kk$
        Case "s", "S" 'save palette
            savefile$ = _SaveFileDialog$("Save File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                For k = 0 To 255
                    Print #1, klr(k)
                Next k
                Close #1
            End If
        Case "l", "L" 'load palette
            loadfile$ = _OpenFileDialog$("Open File", "", "*.*", "*.*", -1)
            If loadfile$ <> "" Then
                _MessageBox "Information", "You selected " + loadfile$
                k = 0
                Open loadfile$ For Input As #1
                Do Until EOF(1)
                    Input #1, klr(k)
                    _PaletteColor k, klr(k)
                    k = k + 1
                Loop
                Close #1
                drawgrid
            End If
        Case "b", "B" 'save basic code for palette to a file
            savefile$ = _SaveFileDialog$("Save Basic Code to File", "", "*.*", "")
            If savefile$ <> "" Then
                _MessageBox "Information", "File will be saved to " + savefile$
                Open savefile$ For Output As #1
                Print #1, "'256 color palette uncomment lines as needed for use"
                Print #1, "'Screen _NewImage(600, 400,256) "
                Print #1, "'dim shared klr(0 to 255) as _unsigned long"
                For k = 0 To 255
                    bc$ = ""
                    bc$ = "klr(" + _Trim$(Str$(k)) + ") = _rgb32(" + _Trim$(Str$(_Red32(klr(k)))) + "," + _Trim$(Str$(_Green32(klr(k)))) + "," + _Trim$(Str$(_Blue32(klr(k)))) + ")"
                    Print #1, bc$
                Next k
                Print #1, "'For k = 0 To 255 "
                Print #1, "' _PaletteColor k, klr(k) "
                Print #1, "' Next k"
                Close #1
            End If
        Case "n", "N" 'toggle display of color numbers on palette grid
            If showpalnos = 0 Then showpalnos = 1 Else showpalnos = 0
            drawgrid
        Case "c", "C"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                Line (10, 310)-(800, 340), klr(0), BF
                pm$ = "Color #: " + Str$(pk) + " R,G,B: " + Str$(_Red32(klr(pk))) + "," + Str$(_Green32(klr(pk))) + "," + Str$(_Blue32(klr(pk)))
                _PrintString (10, 312), pm$
                If pk > 0 And pk < 256 Then tklr = klr(pk)
            End If
        Case "p", "P"
            Mouser mx, my, mb
            If mx > -1 And mx < 1024 And my > -1 And my < 256 Then
                px = mx \ 32
                py = my \ 32
                pk = py * 32 + px
                If pk > 0 And pk < 256 Then klr(pk) = tklr
                _PaletteColor pk, klr(pk)
            End If


    End Select
Loop Until kk$ = Chr$(27)
System

'draw the palette grid
Sub drawgrid
    _PrintMode _KeepBackground
    For y = 0 To 7
        For x = 0 To 31
            yy = y * 32
            xx = x * 16
            dk = yy + x
            xx = xx * 2
            Line (xx, yy)-(xx + 30, yy + 30), dk, BF
            If showpalnos = 1 Then
                _PrintString (xx + 2, yy + 6), _Trim$(Str$(dk))
            End If
    Next x, y
    _PrintString (10, 257), "S - Save File   L - Load File   B - Save Basic Code  N - show color #'s <ESC> -QUIT "
    _PrintString (10, 275), "Left Click - show RGB values    Right Click - change RGB values "
    _PrintString (10, 293), "C - Copy color    P - Paste color"
End Sub
'mouse sub from wiki with added check for mouse(2)
Sub Mouser (x, y, b)
    While _MouseInput: Wend
    b = _MouseButton(1)
    If _MouseButton(2) = -1 Then b = -2
    x = _MouseX
    y = _MouseY
End Sub

Sub defaultpal
    'a default 256 color palette
    klr(0) = _RGB32(0, 0, 0)
    klr(1) = _RGB32(0, 0, 200)
    klr(2) = _RGB32(0, 80, 0)
    klr(3) = _RGB32(0, 217, 217)
    klr(4) = _RGB32(255, 0, 0)
    klr(5) = _RGB32(193, 0, 193)
    klr(6) = _RGB32(149, 5, 5)
    klr(7) = _RGB32(192, 192, 192)
    klr(8) = _RGB32(100, 100, 100)
    klr(9) = _RGB32(0, 128, 255)
    klr(10) = _RGB32(128, 255, 128)
    klr(11) = _RGB32(120, 240, 255)
    klr(12) = _RGB32(255, 128, 0)
    klr(13) = _RGB32(235, 150, 235)
    klr(14) = _RGB32(255, 255, 0)
    klr(15) = _RGB32(235, 235, 235)
    klr(16) = _RGB32(16, 12, 6)
    klr(17) = _RGB32(30, 24, 12)
    klr(18) = _RGB32(12, 16, 6)
    klr(19) = _RGB32(24, 30, 12)
    klr(20) = _RGB32(12, 6, 16)
    klr(21) = _RGB32(16, 6, 12)
    klr(22) = _RGB32(36, 12, 12)
    klr(23) = _RGB32(95, 60, 30)
    klr(24) = _RGB32(97, 70, 52)
    klr(25) = _RGB32(113, 56, 0)
    klr(26) = _RGB32(160, 160, 150)
    klr(27) = _RGB32(240, 240, 142)
    klr(28) = _RGB32(50, 0, 0)
    klr(29) = _RGB32(0, 50, 0)
    klr(30) = _RGB32(0, 0, 50)
    klr(31) = _RGB32(130, 125, 120)
    klr(32) = _RGB32(10, 10, 10)
    klr(33) = _RGB32(0, 0, 210)
    klr(34) = _RGB32(0, 100, 0)
    klr(35) = _RGB32(15, 217, 217)
    klr(36) = _RGB32(255, 15, 15)
    klr(37) = _RGB32(193, 15, 193)
    klr(38) = _RGB32(149, 20, 20)
    klr(39) = _RGB32(199, 199, 199)
    klr(40) = _RGB32(110, 110, 110)
    klr(41) = _RGB32(15, 128, 255)
    klr(42) = _RGB32(132, 255, 132)
    klr(43) = _RGB32(140, 240, 255)
    klr(44) = _RGB32(255, 128, 32)
    klr(45) = _RGB32(240, 155, 240)
    klr(46) = _RGB32(255, 255, 40)
    klr(47) = _RGB32(240, 240, 240)
    klr(48) = _RGB32(48, 38, 19)
    klr(49) = _RGB32(49, 39, 19)
    klr(50) = _RGB32(38, 48, 19)
    klr(51) = _RGB32(39, 49, 19)
    klr(52) = _RGB32(38, 19, 48)
    klr(53) = _RGB32(48, 19, 38)
    klr(54) = _RGB32(48, 18, 18)
    klr(55) = _RGB32(115, 73, 32)
    klr(56) = _RGB32(132, 96, 72)
    klr(57) = _RGB32(183, 91, 0)
    klr(58) = _RGB32(170, 170, 150)
    klr(59) = _RGB32(245, 245, 154)
    klr(60) = _RGB32(60, 0, 0)
    klr(61) = _RGB32(0, 60, 0)
    klr(62) = _RGB32(0, 0, 60)
    klr(63) = _RGB32(110, 125, 135)
    klr(64) = _RGB32(20, 20, 20)
    klr(65) = _RGB32(0, 0, 220)
    klr(66) = _RGB32(0, 120, 0)
    klr(67) = _RGB32(30, 217, 217)
    klr(68) = _RGB32(255, 30, 30)
    klr(69) = _RGB32(193, 30, 193)
    klr(70) = _RGB32(149, 40, 40)
    klr(71) = _RGB32(204, 204, 204)
    klr(72) = _RGB32(120, 120, 120)
    klr(73) = _RGB32(30, 128, 255)
    klr(74) = _RGB32(136, 255, 136)
    klr(75) = _RGB32(160, 240, 255)
    klr(76) = _RGB32(255, 128, 64)
    klr(77) = _RGB32(245, 160, 245)
    klr(78) = _RGB32(255, 255, 80)
    klr(79) = _RGB32(245, 245, 245)
    klr(80) = _RGB32(80, 64, 32)
    klr(81) = _RGB32(94, 75, 37)
    klr(82) = _RGB32(64, 80, 32)
    klr(83) = _RGB32(75, 94, 37)
    klr(84) = _RGB32(64, 32, 80)
    klr(85) = _RGB32(80, 32, 64)
    klr(86) = _RGB32(60, 24, 24)
    klr(87) = _RGB32(125, 83, 33)
    klr(88) = _RGB32(165, 120, 90)
    klr(89) = _RGB32(236, 118, 0)
    klr(90) = _RGB32(180, 180, 150)
    klr(91) = _RGB32(250, 250, 166)
    klr(92) = _RGB32(70, 0, 0)
    klr(93) = _RGB32(0, 70, 0)
    klr(94) = _RGB32(0, 0, 70)
    klr(95) = _RGB32(200, 150, 200)
    klr(96) = _RGB32(30, 30, 30)
    klr(97) = _RGB32(0, 0, 230)
    klr(98) = _RGB32(0, 140, 0)
    klr(99) = _RGB32(60, 217, 217)
    klr(100) = _RGB32(255, 60, 60)
    klr(101) = _RGB32(193, 60, 193)
    klr(102) = _RGB32(149, 60, 60)
    klr(103) = _RGB32(208, 208, 208)
    klr(104) = _RGB32(140, 140, 140)
    klr(105) = _RGB32(45, 128, 255)
    klr(106) = _RGB32(140, 255, 140)
    klr(107) = _RGB32(180, 240, 255)
    klr(108) = _RGB32(255, 128, 96)
    klr(109) = _RGB32(250, 160, 250)
    klr(110) = _RGB32(255, 255, 100)
    klr(111) = _RGB32(250, 245, 245)
    klr(112) = _RGB32(112, 89, 44)
    klr(113) = _RGB32(126, 100, 50)
    klr(114) = _RGB32(89, 112, 44)
    klr(115) = _RGB32(100, 126, 50)
    klr(116) = _RGB32(89, 44, 112)
    klr(117) = _RGB32(112, 44, 89)
    klr(118) = _RGB32(72, 30, 30)
    klr(119) = _RGB32(135, 93, 35)
    klr(120) = _RGB32(192, 156, 135)
    klr(121) = _RGB32(255, 154, 53)
    klr(122) = _RGB32(195, 195, 150)
    klr(123) = _RGB32(255, 255, 178)
    klr(124) = _RGB32(80, 0, 0)
    klr(125) = _RGB32(0, 80, 0)
    klr(126) = _RGB32(0, 0, 80)
    klr(127) = _RGB32(200, 200, 150)
    klr(128) = _RGB32(40, 40, 40)
    klr(129) = _RGB32(0, 0, 240)
    klr(130) = _RGB32(0, 160, 0)
    klr(131) = _RGB32(90, 217, 217)
    klr(132) = _RGB32(255, 90, 90)
    klr(133) = _RGB32(193, 90, 193)
    klr(134) = _RGB32(149, 80, 80)
    klr(135) = _RGB32(212, 212, 212)
    klr(136) = _RGB32(150, 150, 150)
    klr(137) = _RGB32(60, 128, 255)
    klr(138) = _RGB32(150, 255, 150)
    klr(139) = _RGB32(190, 240, 255)
    klr(140) = _RGB32(255, 128, 128)
    klr(141) = _RGB32(250, 170, 250)
    klr(142) = _RGB32(255, 255, 110)
    klr(143) = _RGB32(250, 250, 245)
    klr(144) = _RGB32(144, 115, 57)
    klr(145) = _RGB32(158, 126, 63)
    klr(146) = _RGB32(115, 144, 57)
    klr(147) = _RGB32(126, 158, 63)
    klr(148) = _RGB32(115, 57, 144)
    klr(149) = _RGB32(144, 57, 115)
    klr(150) = _RGB32(84, 36, 36)
    klr(151) = _RGB32(140, 98, 32)
    klr(152) = _RGB32(204, 175, 157)
    klr(153) = _RGB32(255, 177, 100)
    klr(154) = _RGB32(210, 210, 150)
    klr(155) = _RGB32(255, 255, 190)
    klr(156) = _RGB32(90, 0, 0)
    klr(157) = _RGB32(0, 90, 0)
    klr(158) = _RGB32(0, 0, 90)
    klr(159) = _RGB32(200, 200, 200)
    klr(160) = _RGB32(50, 50, 50)
    klr(161) = _RGB32(0, 0, 250)
    klr(162) = _RGB32(0, 180, 0)
    klr(163) = _RGB32(120, 217, 217)
    klr(164) = _RGB32(255, 120, 120)
    klr(165) = _RGB32(193, 120, 193)
    klr(166) = _RGB32(149, 100, 100)
    klr(167) = _RGB32(216, 216, 216)
    klr(168) = _RGB32(160, 160, 160)
    klr(169) = _RGB32(75, 128, 255)
    klr(170) = _RGB32(160, 255, 160)
    klr(171) = _RGB32(200, 250, 255)
    klr(172) = _RGB32(255, 136, 136)
    klr(173) = _RGB32(250, 180, 250)
    klr(174) = _RGB32(255, 255, 120)
    klr(175) = _RGB32(250, 250, 250)
    klr(176) = _RGB32(176, 140, 70)
    klr(177) = _RGB32(190, 152, 76)
    klr(178) = _RGB32(140, 176, 70)
    klr(179) = _RGB32(152, 190, 76)
    klr(180) = _RGB32(140, 70, 176)
    klr(181) = _RGB32(176, 70, 140)
    klr(182) = _RGB32(96, 40, 40)
    klr(183) = _RGB32(150, 108, 40)
    klr(184) = _RGB32(217, 196, 183)
    klr(185) = _RGB32(255, 192, 130)
    klr(186) = _RGB32(225, 225, 150)
    klr(187) = _RGB32(255, 255, 202)
    klr(188) = _RGB32(100, 0, 0)
    klr(189) = _RGB32(0, 100, 0)
    klr(190) = _RGB32(0, 0, 100)
    klr(191) = _RGB32(250, 200, 200)
    klr(192) = _RGB32(60, 60, 60)
    klr(193) = _RGB32(20, 20, 250)
    klr(194) = _RGB32(0, 200, 0)
    klr(195) = _RGB32(150, 217, 217)
    klr(196) = _RGB32(255, 150, 150)
    klr(197) = _RGB32(193, 150, 193)
    klr(198) = _RGB32(149, 120, 120)
    klr(199) = _RGB32(228, 228, 228)
    klr(200) = _RGB32(170, 170, 170)
    klr(201) = _RGB32(90, 128, 255)
    klr(202) = _RGB32(170, 255, 170)
    klr(203) = _RGB32(200, 255, 255)
    klr(204) = _RGB32(255, 148, 148)
    klr(205) = _RGB32(255, 185, 255)
    klr(206) = _RGB32(255, 255, 140)
    klr(207) = _RGB32(255, 250, 250)
    klr(208) = _RGB32(208, 166, 83)
    klr(209) = _RGB32(222, 177, 88)
    klr(210) = _RGB32(166, 208, 83)
    klr(211) = _RGB32(177, 222, 88)
    klr(212) = _RGB32(166, 83, 208)
    klr(213) = _RGB32(208, 83, 166)
    klr(214) = _RGB32(108, 44, 44)
    klr(215) = _RGB32(155, 113, 44)
    klr(216) = _RGB32(223, 206, 196)
    klr(217) = _RGB32(255, 220, 185)
    klr(218) = _RGB32(240, 240, 150)
    klr(219) = _RGB32(255, 255, 234)
    klr(220) = _RGB32(120, 0, 0)
    klr(221) = _RGB32(0, 120, 0)
    klr(222) = _RGB32(0, 0, 120)
    klr(223) = _RGB32(250, 250, 200)
    klr(224) = _RGB32(70, 70, 70)
    klr(225) = _RGB32(40, 40, 250)
    klr(226) = _RGB32(0, 220, 0)
    klr(227) = _RGB32(150, 217, 217)
    klr(228) = _RGB32(255, 180, 180)
    klr(229) = _RGB32(193, 180, 193)
    klr(230) = _RGB32(149, 140, 140)
    klr(231) = _RGB32(240, 240, 236)
    klr(232) = _RGB32(180, 180, 180)
    klr(233) = _RGB32(115, 128, 255)
    klr(234) = _RGB32(190, 255, 190)
    klr(235) = _RGB32(220, 255, 255)
    klr(236) = _RGB32(255, 160, 160)
    klr(237) = _RGB32(255, 200, 255)
    klr(238) = _RGB32(255, 255, 160)
    klr(239) = _RGB32(255, 255, 250)
    klr(240) = _RGB32(240, 192, 96)
    klr(241) = _RGB32(254, 203, 101)
    klr(242) = _RGB32(192, 240, 96)
    klr(243) = _RGB32(203, 254, 101)
    klr(244) = _RGB32(192, 96, 240)
    klr(245) = _RGB32(240, 96, 192)
    klr(246) = _RGB32(120, 48, 48)
    klr(247) = _RGB32(165, 120, 45)
    klr(248) = _RGB32(227, 214, 204)
    klr(249) = _RGB32(255, 235, 195)
    klr(250) = _RGB32(255, 255, 150)
    klr(251) = _RGB32(255, 255, 249)
    klr(252) = _RGB32(140, 0, 0)
    klr(253) = _RGB32(0, 140, 0)
    klr(254) = _RGB32(0, 0, 140)
    klr(255) = _RGB32(250, 250, 250)
    For k = 0 To 255
        _PaletteColor k, klr(k)
    Next k

End Sub
Reply
#7
(02-02-2023, 12:21 PM)SMcNeill Wrote: Here's my goto 256 color palette routines:

Code: (Select All)
CONST Black = 0~%%
CONST Blue = 1~%%
CONST Green = 2~%%
CONST Cyan = 3~%%
CONST Red = 4~%%
CONST Magenta = 5~%%
CONST Brown = 6~%%
CONST White = 7~%%
CONST Gray = 8~%%
CONST LightBlue = 9~%%
CONST LightGreen = 10~%%
CONST LightCyan = 11~%%
CONST LightRed = 12~%%
CONST LightMagenta = 13~%%
CONST Yellow = 14~%%
CONST BrightWhite = 15~%%
CONST AliceBlue = 16~%%
CONST Almond = 17~%%
CONST AntiqueBrass = 18~%%
CONST AntiqueWhite = 19~%%
CONST Apricot = 20~%%
CONST Aqua = 21~%%
CONST Aquamarine = 22~%%
CONST Asparagus = 23~%%
CONST AtomicTangerine = 24~%%
CONST Azure = 25~%%
CONST BananaMania = 26~%%
CONST Beaver = 27~%%
CONST Beige = 28~%%
CONST Bisque = 29~%%
CONST Bittersweet = 30~%%
CONST BlanchedAlmond = 31~%%
CONST BlizzardBlue = 32~%%
CONST BlueBell = 33~%%
CONST BlueGray = 34~%%
CONST BlueGreen = 35~%%
CONST BlueViolet = 36~%%
CONST Blush = 37~%%
CONST BrickRed = 38~%%
CONST BurlyWood = 39~%%
CONST BurntOrange = 40~%%
CONST BurntSienna = 41~%%
CONST CadetBlue = 42~%%
CONST Canary = 43~%%
CONST CaribbeanGreen = 44~%%
CONST CarnationPink = 45~%%
CONST Cerise = 46~%%
CONST Cerulean = 47~%%
CONST ChartReuse = 48~%%
CONST Chestnut = 49~%%
CONST Chocolate = 50~%%
CONST Copper = 51~%%
CONST Coral = 52~%%
CONST Cornflower = 53~%%
CONST CornflowerBlue = 54~%%
CONST Cornsilk = 55~%%
CONST CottonCandy = 56~%%
CONST Crimson = 57~%%
CONST Dandelion = 58~%%
CONST DarkBlue = 59~%%
CONST DarkCyan = 60~%%
CONST DarkGoldenRod = 61~%%
CONST DarkGray = 62~%%
CONST DarkGreen = 63~%%
CONST DarkKhaki = 64~%%
CONST DarkMagenta = 65~%%
CONST DarkOliveGreen = 66~%%
CONST DarkOrange = 67~%%
CONST DarkOrchid = 68~%%
CONST DarkRed = 69~%%
CONST DarkSalmon = 70~%%
CONST DarkSeaGreen = 71~%%
CONST DarkSlateBlue = 72~%%
CONST DarkSlateGray = 73~%%
CONST DarkTurquoise = 74~%%
CONST DarkViolet = 75~%%
CONST DeepPink = 76~%%
CONST DeepSkyBlue = 77~%%
CONST Denim = 78~%%
CONST DesertSand = 79~%%
CONST DimGray = 80~%%
CONST DodgerBlue = 81~%%
CONST Eggplant = 82~%%
CONST ElectricLime = 83~%%
CONST Fern = 84~%%
CONST FireBrick = 85~%%
CONST Floralwhite = 86~%%
CONST ForestGreen = 87~%%
CONST Fuchsia = 88~%%
CONST FuzzyWuzzy = 89~%%
CONST Gainsboro = 90~%%
CONST GhostWhite = 91~%%
CONST Gold = 92~%%
CONST GoldenRod = 93~%%
CONST GrannySmithApple = 94~%%
CONST GreenBlue = 95~%%
CONST GreenYellow = 96~%%
CONST HoneyDew = 97~%%
CONST HotMagenta = 98~%%
CONST HotPink = 99~%%
CONST Inchworm = 100~%%
CONST IndianRed = 101~%%
CONST Indigo = 102~%%
CONST Ivory = 103~%%
CONST JazzberryJam = 104~%%
CONST JungleGreen = 105~%%
CONST Khaki = 106~%%
CONST LaserLemon = 107~%%
CONST Lavender = 108~%%
CONST LavenderBlush = 109~%%
CONST LawnGreen = 110~%%
CONST LemonChiffon = 111~%%
CONST LemonYellow = 112~%%
CONST LightCoral = 113~%%
CONST LightGoldenRodYellow = 114~%%
CONST LightGray = 115~%%
CONST LightGreen2 = 116~%%
CONST LightPink = 117~%%
CONST LightSalmon = 118~%%
CONST LightSeaGreen = 119~%%
CONST LightSkyBlue = 120~%%
CONST LightSlateGray = 121~%%
CONST LightSteelBlue = 122~%%
CONST LightYellow = 123~%%
CONST Lime = 124~%%
CONST LimeGreen = 125~%%
CONST Linen = 126~%%
CONST MacaroniAndCheese = 127~%%
CONST MagicMint = 128~%%
CONST Mahogany = 129~%%
CONST Maize = 130~%%
CONST Manatee = 131~%%
CONST MangoTango = 132~%%
CONST Maroon = 133~%%
CONST Mauvelous = 134~%%
CONST MediumAquamarine = 135~%%
CONST MediumBlue = 136~%%
CONST MediumOrchid = 137~%%
CONST MediumPurple = 138~%%
CONST MediumSeaGreen = 139~%%
CONST MediumSlateBlue = 140~%%
CONST MediumSpringGreen = 141~%%
CONST MediumTurquoise = 142~%%
CONST MediumVioletRed = 143~%%
CONST Melon = 144~%%
CONST MidnightBlue = 145~%%
CONST MintCream = 146~%%
CONST MistyRose = 147~%%
CONST Moccasin = 148~%%
CONST MountainMeadow = 149~%%
CONST Mulberry = 150~%%
CONST NavajoWhite = 151~%%
CONST Navy = 152~%%
CONST NavyBlue = 153~%%
CONST NeonCarrot = 154~%%
CONST OldLace = 155~%%
CONST Olive = 156~%%
CONST OliveDrab = 157~%%
CONST OliveGreen = 158~%%
CONST Orange = 159~%%
CONST OrangeRed = 160~%%
CONST OrangeYellow = 161~%%
CONST Orchid = 162~%%
CONST OuterSpace = 163~%%
CONST OutrageousOrange = 164~%%
CONST PacificBlue = 165~%%
CONST PaleGoldenRod = 166~%%
CONST PaleGreen = 167~%%
CONST PaleTurquoise = 168~%%
CONST PaleVioletRed = 169~%%
CONST PapayaWhip = 170~%%
CONST Peach = 171~%%
CONST PeachPuff = 172~%%
CONST Periwinkle = 173~%%
CONST Peru = 174~%%
CONST PiggyPink = 175~%%
CONST PineGreen = 176~%%
CONST Pink = 177~%%
CONST PinkFlamingo = 178~%%
CONST PinkSherbet = 179~%%
CONST Plum = 180~%%
CONST PowderBlue = 181~%%
CONST Purple = 182~%%
CONST PurpleHeart = 183~%%
CONST PurpleMountainsMajesty = 184~%%
CONST PurplePizzazz = 185~%%
CONST RadicalRed = 186~%%
CONST RawSienna = 187~%%
CONST RawUmber = 188~%%
CONST RazzleDazzleRose = 189~%%
CONST Razzmatazz = 190~%%
CONST RedOrange = 191~%%
CONST RedViolet = 192~%%
CONST RobinsEggBlue = 193~%%
CONST RosyBrown = 194~%%
CONST RoyalBlue = 195~%%
CONST RoyalPurple = 196~%%
CONST SaddleBrown = 197~%%
CONST Salmon = 198~%%
CONST SandyBrown = 199~%%
CONST Scarlet = 200~%%
CONST ScreaminGreen = 201~%%
CONST SeaGreen = 202~%%
CONST SeaShell = 203~%%
CONST Sepia = 204~%%
CONST Shadow = 205~%%
CONST Shamrock = 206~%%
CONST ShockingPink = 207~%%
CONST Sienna = 208~%%
CONST Silver = 209~%%
CONST SkyBlue = 210~%%
CONST SlateBlue = 211~%%
CONST SlateGray = 212~%%
CONST Snow = 213~%%
CONST SpringGreen = 214~%%
CONST SteelBlue = 215~%%
CONST Sunglow = 216~%%
CONST SunsetOrange = 217~%%
CONST Tann = 218~%%
CONST Teal = 219~%%
CONST TealBlue = 220~%%
CONST Thistle = 221~%%
CONST TickleMePink = 222~%%
CONST Timberwolf = 223~%%
CONST Tomato = 224~%%
CONST TropicalRainForest = 225~%%
CONST Tumbleweed = 226~%%
CONST Turquoise = 227~%%
CONST TurquoiseBlue = 228~%%
CONST UnmellowYellow = 229~%%
CONST Violet = 230~%%
CONST VioletBlue = 231~%%
CONST VioletRed = 232~%%
CONST VividTangerine = 233~%%
CONST VividViolet = 234~%%
CONST Wheat = 235~%%
CONST Whitesmoke = 236~%%
CONST WildBlueYonder = 237~%%
CONST WildStrawberry = 238~%%
CONST WildWatermelon = 239~%%
CONST Wisteria = 240~%%
CONST YellowGreen = 241~%%
CONST YellowOrange = 242~%%


SCREEN _NEWIMAGE(800, 600, 256)
Set256Palette _DISPLAY

LINE (100, 100)-(200, 200), Silver, BF
LINE (200, 100)-(300, 200), Gold, BF
LINE (300, 100)-(400, 200), Peach, BF
LINE (400, 100)-(500, 200), SkyBlue, BF







SUB Set256Palette (handle)
    D = _DEST: S = _SOURCE
    _DEST handle: _SOURCE handle
    _PALETTECOLOR 16, _RGBA32(240, 248, 255, 255)
    _PALETTECOLOR 17, _RGBA32(239, 222, 205, 255)
    _PALETTECOLOR 18, _RGBA32(205, 149, 117, 255)
    _PALETTECOLOR 19, _RGBA32(250, 235, 215, 255)
    _PALETTECOLOR 20, _RGBA32(253, 217, 181, 255)
    _PALETTECOLOR 21, _RGBA32(0, 255, 255, 255)
    _PALETTECOLOR 22, _RGBA32(127, 255, 212, 255)
    _PALETTECOLOR 23, _RGBA32(135, 169, 107, 255)
    _PALETTECOLOR 24, _RGBA32(255, 164, 116, 255)
    _PALETTECOLOR 25, _RGBA32(240, 255, 255, 255)
    _PALETTECOLOR 26, _RGBA32(250, 231, 181, 255)
    _PALETTECOLOR 27, _RGBA32(159, 129, 112, 255)
    _PALETTECOLOR 28, _RGBA32(245, 245, 220, 255)
    _PALETTECOLOR 29, _RGBA32(255, 228, 196, 255)
    _PALETTECOLOR 30, _RGBA32(253, 124, 110, 255)
    _PALETTECOLOR 31, _RGBA32(255, 235, 205, 255)
    _PALETTECOLOR 32, _RGBA32(172, 229, 238, 255)
    _PALETTECOLOR 33, _RGBA32(162, 162, 208, 255)
    _PALETTECOLOR 34, _RGBA32(102, 153, 204, 255)
    _PALETTECOLOR 35, _RGBA32(13, 152, 186, 255)
    _PALETTECOLOR 36, _RGBA32(138, 43, 226, 255)
    _PALETTECOLOR 37, _RGBA32(222, 93, 131, 255)
    _PALETTECOLOR 38, _RGBA32(203, 65, 84, 255)
    _PALETTECOLOR 39, _RGBA32(222, 184, 135, 255)
    _PALETTECOLOR 40, _RGBA32(255, 127, 73, 255)
    _PALETTECOLOR 41, _RGBA32(234, 126, 93, 255)
    _PALETTECOLOR 42, _RGBA32(95, 158, 160, 255)
    _PALETTECOLOR 43, _RGBA32(255, 255, 153, 255)
    _PALETTECOLOR 44, _RGBA32(28, 211, 162, 255)
    _PALETTECOLOR 45, _RGBA32(255, 170, 204, 255)
    _PALETTECOLOR 46, _RGBA32(221, 68, 146, 255)
    _PALETTECOLOR 47, _RGBA32(29, 172, 214, 255)
    _PALETTECOLOR 48, _RGBA32(127, 255, 0, 255)
    _PALETTECOLOR 49, _RGBA32(188, 93, 88, 255)
    _PALETTECOLOR 50, _RGBA32(210, 105, 30, 255)
    _PALETTECOLOR 51, _RGBA32(221, 148, 117, 255)
    _PALETTECOLOR 52, _RGBA32(255, 127, 80, 255)
    _PALETTECOLOR 53, _RGBA32(154, 206, 235, 255)
    _PALETTECOLOR 54, _RGBA32(100, 149, 237, 255)
    _PALETTECOLOR 55, _RGBA32(255, 248, 220, 255)
    _PALETTECOLOR 56, _RGBA32(255, 188, 217, 255)
    _PALETTECOLOR 57, _RGBA32(220, 20, 60, 255)
    _PALETTECOLOR 58, _RGBA32(253, 219, 109, 255)
    _PALETTECOLOR 59, _RGBA32(0, 0, 139, 255)
    _PALETTECOLOR 60, _RGBA32(0, 139, 139, 255)
    _PALETTECOLOR 61, _RGBA32(184, 134, 11, 255)
    _PALETTECOLOR 62, _RGBA32(169, 169, 169, 255)
    _PALETTECOLOR 63, _RGBA32(0, 100, 0, 255)
    _PALETTECOLOR 64, _RGBA32(189, 183, 107, 255)
    _PALETTECOLOR 65, _RGBA32(139, 0, 139, 255)
    _PALETTECOLOR 66, _RGBA32(85, 107, 47, 255)
    _PALETTECOLOR 67, _RGBA32(255, 140, 0, 255)
    _PALETTECOLOR 68, _RGBA32(153, 50, 204, 255)
    _PALETTECOLOR 69, _RGBA32(139, 0, 0, 255)
    _PALETTECOLOR 70, _RGBA32(233, 150, 122, 255)
    _PALETTECOLOR 71, _RGBA32(143, 188, 143, 255)
    _PALETTECOLOR 72, _RGBA32(72, 61, 139, 255)
    _PALETTECOLOR 73, _RGBA32(47, 79, 79, 255)
    _PALETTECOLOR 74, _RGBA32(0, 206, 209, 255)
    _PALETTECOLOR 75, _RGBA32(148, 0, 211, 255)
    _PALETTECOLOR 76, _RGBA32(255, 20, 147, 255)
    _PALETTECOLOR 77, _RGBA32(0, 191, 255, 255)
    _PALETTECOLOR 78, _RGBA32(43, 108, 196, 255)
    _PALETTECOLOR 79, _RGBA32(239, 205, 184, 255)
    _PALETTECOLOR 80, _RGBA32(105, 105, 105, 255)
    _PALETTECOLOR 81, _RGBA32(30, 144, 255, 255)
    _PALETTECOLOR 82, _RGBA32(110, 81, 96, 255)
    _PALETTECOLOR 83, _RGBA32(206, 255, 29, 255)
    _PALETTECOLOR 84, _RGBA32(113, 188, 120, 255)
    _PALETTECOLOR 85, _RGBA32(178, 34, 34, 255)
    _PALETTECOLOR 86, _RGBA32(255, 250, 240, 255)
    _PALETTECOLOR 87, _RGBA32(34, 139, 34, 255)
    _PALETTECOLOR 88, _RGBA32(195, 100, 197, 255)
    _PALETTECOLOR 89, _RGBA32(204, 102, 102, 255)
    _PALETTECOLOR 90, _RGBA32(220, 220, 220, 255)
    _PALETTECOLOR 91, _RGBA32(248, 248, 255, 255)
    _PALETTECOLOR 92, _RGBA32(255, 215, 0, 255)
    _PALETTECOLOR 93, _RGBA32(218, 165, 32, 255)
    _PALETTECOLOR 94, _RGBA32(168, 228, 160, 255)
    _PALETTECOLOR 95, _RGBA32(17, 100, 180, 255)
    _PALETTECOLOR 96, _RGBA32(173, 255, 47, 255)
    _PALETTECOLOR 97, _RGBA32(240, 255, 240, 255)
    _PALETTECOLOR 98, _RGBA32(255, 29, 206, 255)
    _PALETTECOLOR 99, _RGBA32(255, 105, 180, 255)
    _PALETTECOLOR 100, _RGBA32(178, 236, 93, 255)
    _PALETTECOLOR 101, _RGBA32(205, 92, 92, 255)
    _PALETTECOLOR 102, _RGBA32(75, 0, 130, 255)
    _PALETTECOLOR 103, _RGBA32(255, 255, 240, 255)
    _PALETTECOLOR 104, _RGBA32(202, 55, 103, 255)
    _PALETTECOLOR 105, _RGBA32(59, 176, 143, 255)
    _PALETTECOLOR 106, _RGBA32(240, 230, 140, 255)
    _PALETTECOLOR 107, _RGBA32(254, 254, 34, 255)
    _PALETTECOLOR 108, _RGBA32(230, 230, 250, 255)
    _PALETTECOLOR 109, _RGBA32(255, 240, 245, 255)
    _PALETTECOLOR 110, _RGBA32(124, 252, 0, 255)
    _PALETTECOLOR 111, _RGBA32(255, 250, 205, 255)
    _PALETTECOLOR 112, _RGBA32(255, 244, 79, 255)
    _PALETTECOLOR 113, _RGBA32(240, 128, 128, 255)
    _PALETTECOLOR 114, _RGBA32(250, 250, 210, 255)
    _PALETTECOLOR 115, _RGBA32(211, 211, 211, 255)
    _PALETTECOLOR 116, _RGBA32(144, 238, 144, 255)
    _PALETTECOLOR 117, _RGBA32(255, 182, 193, 255)
    _PALETTECOLOR 118, _RGBA32(255, 160, 122, 255)
    _PALETTECOLOR 119, _RGBA32(32, 178, 170, 255)
    _PALETTECOLOR 120, _RGBA32(135, 206, 250, 255)
    _PALETTECOLOR 121, _RGBA32(119, 136, 153, 255)
    _PALETTECOLOR 122, _RGBA32(176, 196, 222, 255)
    _PALETTECOLOR 123, _RGBA32(255, 255, 224, 255)
    _PALETTECOLOR 124, _RGBA32(0, 255, 0, 255)
    _PALETTECOLOR 125, _RGBA32(50, 205, 50, 255)
    _PALETTECOLOR 126, _RGBA32(250, 240, 230, 255)
    _PALETTECOLOR 127, _RGBA32(255, 189, 136, 255)
    _PALETTECOLOR 128, _RGBA32(170, 240, 209, 255)
    _PALETTECOLOR 129, _RGBA32(205, 74, 76, 255)
    _PALETTECOLOR 130, _RGBA32(237, 209, 156, 255)
    _PALETTECOLOR 131, _RGBA32(151, 154, 170, 255)
    _PALETTECOLOR 132, _RGBA32(255, 130, 67, 255)
    _PALETTECOLOR 133, _RGBA32(128, 0, 0, 255)
    _PALETTECOLOR 134, _RGBA32(239, 152, 170, 255)
    _PALETTECOLOR 135, _RGBA32(102, 205, 170, 255)
    _PALETTECOLOR 136, _RGBA32(0, 0, 205, 255)
    _PALETTECOLOR 137, _RGBA32(186, 85, 211, 255)
    _PALETTECOLOR 138, _RGBA32(147, 112, 219, 255)
    _PALETTECOLOR 139, _RGBA32(60, 179, 113, 255)
    _PALETTECOLOR 140, _RGBA32(123, 104, 238, 255)
    _PALETTECOLOR 141, _RGBA32(0, 250, 154, 255)
    _PALETTECOLOR 142, _RGBA32(72, 209, 204, 255)
    _PALETTECOLOR 143, _RGBA32(199, 21, 133, 255)
    _PALETTECOLOR 144, _RGBA32(253, 188, 180, 255)
    _PALETTECOLOR 145, _RGBA32(25, 25, 112, 255)
    _PALETTECOLOR 146, _RGBA32(245, 255, 250, 255)
    _PALETTECOLOR 147, _RGBA32(255, 228, 225, 255)
    _PALETTECOLOR 148, _RGBA32(255, 228, 181, 255)
    _PALETTECOLOR 149, _RGBA32(48, 186, 143, 255)
    _PALETTECOLOR 150, _RGBA32(197, 75, 140, 255)
    _PALETTECOLOR 151, _RGBA32(255, 222, 173, 255)
    _PALETTECOLOR 152, _RGBA32(0, 0, 128, 255)
    _PALETTECOLOR 153, _RGBA32(25, 116, 210, 255)
    _PALETTECOLOR 154, _RGBA32(255, 163, 67, 255)
    _PALETTECOLOR 155, _RGBA32(253, 245, 230, 255)
    _PALETTECOLOR 156, _RGBA32(128, 128, 0, 255)
    _PALETTECOLOR 157, _RGBA32(107, 142, 35, 255)
    _PALETTECOLOR 158, _RGBA32(186, 184, 108, 255)
    _PALETTECOLOR 159, _RGBA32(255, 165, 0, 255)
    _PALETTECOLOR 160, _RGBA32(255, 69, 0, 255)
    _PALETTECOLOR 161, _RGBA32(248, 213, 104, 255)
    _PALETTECOLOR 162, _RGBA32(218, 112, 214, 255)
    _PALETTECOLOR 163, _RGBA32(65, 74, 76, 255)
    _PALETTECOLOR 164, _RGBA32(255, 110, 74, 255)
    _PALETTECOLOR 165, _RGBA32(28, 169, 201, 255)
    _PALETTECOLOR 166, _RGBA32(238, 232, 170, 255)
    _PALETTECOLOR 167, _RGBA32(152, 251, 152, 255)
    _PALETTECOLOR 168, _RGBA32(175, 238, 238, 255)
    _PALETTECOLOR 169, _RGBA32(219, 112, 147, 255)
    _PALETTECOLOR 170, _RGBA32(255, 239, 213, 255)
    _PALETTECOLOR 171, _RGBA32(255, 207, 171, 255)
    _PALETTECOLOR 172, _RGBA32(255, 218, 185, 255)
    _PALETTECOLOR 173, _RGBA32(197, 208, 230, 255)
    _PALETTECOLOR 174, _RGBA32(205, 133, 63, 255)
    _PALETTECOLOR 175, _RGBA32(253, 221, 230, 255)
    _PALETTECOLOR 176, _RGBA32(21, 128, 120, 255)
    _PALETTECOLOR 177, _RGBA32(255, 192, 203, 255)
    _PALETTECOLOR 178, _RGBA32(252, 116, 253, 255)
    _PALETTECOLOR 179, _RGBA32(247, 143, 167, 255)
    _PALETTECOLOR 180, _RGBA32(221, 160, 221, 255)
    _PALETTECOLOR 181, _RGBA32(176, 224, 230, 255)
    _PALETTECOLOR 182, _RGBA32(128, 0, 128, 255)
    _PALETTECOLOR 183, _RGBA32(116, 66, 200, 255)
    _PALETTECOLOR 184, _RGBA32(157, 129, 186, 255)
    _PALETTECOLOR 185, _RGBA32(254, 78, 218, 255)
    _PALETTECOLOR 186, _RGBA32(255, 73, 108, 255)
    _PALETTECOLOR 187, _RGBA32(214, 138, 89, 255)
    _PALETTECOLOR 188, _RGBA32(113, 75, 35, 255)
    _PALETTECOLOR 189, _RGBA32(255, 72, 208, 255)
    _PALETTECOLOR 190, _RGBA32(227, 37, 107, 255)
    _PALETTECOLOR 191, _RGBA32(255, 83, 73, 255)
    _PALETTECOLOR 192, _RGBA32(192, 68, 143, 255)
    _PALETTECOLOR 193, _RGBA32(31, 206, 203, 255)
    _PALETTECOLOR 194, _RGBA32(188, 143, 143, 255)
    _PALETTECOLOR 195, _RGBA32(65, 105, 225, 255)
    _PALETTECOLOR 196, _RGBA32(120, 81, 169, 255)
    _PALETTECOLOR 197, _RGBA32(139, 69, 19, 255)
    _PALETTECOLOR 198, _RGBA32(250, 128, 114, 255)
    _PALETTECOLOR 199, _RGBA32(244, 164, 96, 255)
    _PALETTECOLOR 200, _RGBA32(252, 40, 71, 255)
    _PALETTECOLOR 201, _RGBA32(118, 255, 122, 255)
    _PALETTECOLOR 202, _RGBA32(46, 139, 87, 255)
    _PALETTECOLOR 203, _RGBA32(255, 245, 238, 255)
    _PALETTECOLOR 204, _RGBA32(165, 105, 79, 255)
    _PALETTECOLOR 205, _RGBA32(138, 121, 93, 255)
    _PALETTECOLOR 206, _RGBA32(69, 206, 162, 255)
    _PALETTECOLOR 207, _RGBA32(251, 126, 253, 255)
    _PALETTECOLOR 208, _RGBA32(160, 82, 45, 255)
    _PALETTECOLOR 209, _RGBA32(192, 192, 192, 255)
    _PALETTECOLOR 210, _RGBA32(135, 206, 235, 255)
    _PALETTECOLOR 211, _RGBA32(106, 90, 205, 255)
    _PALETTECOLOR 212, _RGBA32(112, 128, 144, 255)
    _PALETTECOLOR 213, _RGBA32(255, 250, 250, 255)
    _PALETTECOLOR 214, _RGBA32(0, 255, 127, 255)
    _PALETTECOLOR 215, _RGBA32(70, 130, 180, 255)
    _PALETTECOLOR 216, _RGBA32(255, 207, 72, 255)
    _PALETTECOLOR 217, _RGBA32(253, 94, 83, 255)
    _PALETTECOLOR 218, _RGBA32(210, 180, 140, 255)
    _PALETTECOLOR 219, _RGBA32(0, 128, 128, 255)
    _PALETTECOLOR 220, _RGBA32(24, 167, 181, 255)
    _PALETTECOLOR 221, _RGBA32(216, 191, 216, 255)
    _PALETTECOLOR 222, _RGBA32(252, 137, 172, 255)
    _PALETTECOLOR 223, _RGBA32(219, 215, 210, 255)
    _PALETTECOLOR 224, _RGBA32(255, 99, 71, 255)
    _PALETTECOLOR 225, _RGBA32(23, 128, 109, 255)
    _PALETTECOLOR 226, _RGBA32(222, 170, 136, 255)
    _PALETTECOLOR 227, _RGBA32(64, 224, 208, 255)
    _PALETTECOLOR 228, _RGBA32(119, 221, 231, 255)
    _PALETTECOLOR 229, _RGBA32(255, 255, 102, 255)
    _PALETTECOLOR 230, _RGBA32(238, 130, 238, 255)
    _PALETTECOLOR 231, _RGBA32(50, 74, 178, 255)
    _PALETTECOLOR 232, _RGBA32(247, 83, 148, 255)
    _PALETTECOLOR 233, _RGBA32(255, 160, 137, 255)
    _PALETTECOLOR 234, _RGBA32(143, 80, 157, 255)
    _PALETTECOLOR 235, _RGBA32(245, 222, 179, 255)
    _PALETTECOLOR 236, _RGBA32(245, 245, 245, 255)
    _PALETTECOLOR 237, _RGBA32(162, 173, 208, 255)
    _PALETTECOLOR 238, _RGBA32(255, 67, 164, 255)
    _PALETTECOLOR 239, _RGBA32(252, 108, 133, 255)
    _PALETTECOLOR 240, _RGBA32(205, 164, 222, 255)
    _PALETTECOLOR 241, _RGBA32(154, 205, 50, 255)
    _PALETTECOLOR 242, _RGBA32(255, 174, 66, 255)
    _DEST D: _SOURCE S
END SUB


Put the CONSTs at the start of the program, and then just call the SUB to set any screen that needs the 256 color palette.  (Note that only 242 of the colors are actually named.  The remaining 13 are reserved for user-defined colors/names.)

It is indeed a palette but  if you want to edit more than 13 colors at runtime defining constants in that manner can be problematic.
Reply
#8
Better stick only with from Blue to Gray and then just add "Light" in front of each for the bright versions. Exception "Yellow" over "Light Brown". Because "Alice Blue" isn't in the imagination of most people. I wouldn't try to give names to more than 16 colors in any setup. I was supposed to memorize the color names available in Openoffice v3 Draw app, or the box of 64 Crayola crayons...
Reply




Users browsing this thread: 1 Guest(s)