Color Palette - PicoCalc Program

ColorP.bas is a program to experiment with different text colors and backgrounds. It is a must have app to pick the right colors for your new programs and games. The rich features let you:

  1. Pick foreground & background colors by rbg elements
  2. Displays colors over a variety of text and textures
  3. Provides values as an 24bit integer and hex values
  4. Save a bmp for future reference
  5. Create a log of your favorite color combos for later reference

Please give my little program a test drive and post back pic’s of the best color palettes you’ve made.

Note: This program was written directly one the PicoCalc and my first major basic program so please ignore any code style blunders or inefficient code.

'a program for picking color palettes
'



'set rpg vars at 0
fr = 0
fg = 0
fb = 0
br = 0
bg = 0
bb = 0

'top line to render colors
LT$ = Chr$(201) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(203) +Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205)
LT$ = LT$ + Chr$(205) + Chr$(205)  +Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(187)

'row line to render colors
LR$ = Chr$(186) + Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(186) +Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31)   + Chr$(31)
LR$ = LR$ + Chr$(31) + Chr$(31)  +Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(31) + Chr$(31) +  Chr$(31) + Chr$(186)

'middle line to render colors
LM$ = Chr$(204) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(206) +Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205)
LM$ = LM$ + Chr$(205) + Chr$(205)  +Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(185)


'bottom line to render colors
LB$ = Chr$(200) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(202) +Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205)
LB$ = LB$ + Chr$(205) + Chr$(205)  +Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(205) + Chr$(205) +  Chr$(205) + Chr$(188)
'text to render
LT1$ = "`/\-=[]~?|_+{}!@#$%^&"
LT2$ = "*()<>;':1234567890ABC"
LT3$ = "DEFGHIJKLMNOPQRSTUVWX"
LT4$ = "YZabcdefghijklmnopqrt"

Print
Print
Print

'lables for rgb values
Text 25, 10, "RED", "C", 4, 1,   RGB(255,0,0)
Text 75, 10, "GREEN", "C", 4, 1,   RGB(0,255,0)
Text 125, 10, "BLUE", "C",  4, 1,   RGB(0,0,255 )
Text 185, 10, "RED", "C", 4, 1,   RGB(255,0,0)
Text 235, 10, "GREEN", "C", 4, 1,   RGB(0,255,0)
Text 285, 10, "BLUE", "C", 4, 1,   RGB(0,0,255 )

'display rgb values
Text 25, 30, Str$(fr), "C", 4, 1
Text 75, 30, Str$(fg), "C", 4, 1
Text 125, 30, Str$(fb), "C", 4, 1
Text 185, 30, Str$(br), "C", 4, 1
Text 235, 30, Str$(bg), "C", 4, 1
Text 285, 30, Str$(bb), "C", 4, 1


'arrows to show changing rgb
Text 15, 75, Chr$(144), "CM", 4, 2
Text 35, 75, Chr$(144), "CM", 4, 1
Text 65, 75, Chr$(144), "CM", 4, 2
Text 85, 75, Chr$(144), "CM", 4, 1
Text 115, 75, Chr$(144), "CM", 4, 2
Text 135, 75, Chr$(144), "CM", 4, 1
Text 175, 75, Chr$(144), "CM", 4, 2
Text 195, 75, Chr$(144), "CM", 4, 1
Text 225, 75, Chr$(144), "CM", 4, 2
Text 245, 75, Chr$(144), "CM", 4, 1
Text 275, 75, Chr$(144), "CM", 4, 2
Text 295, 75, Chr$(144), "CM", 4, 1



'label for keys to change values
Text 15, 55, "1", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 35, 55, "2", "CM", 1, 1,    RGB(white), RGB(100,100,100)
Text 65, 55, "3", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 85, 55, "4", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 115, 55, "5", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 135, 55, "6", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 15, 90, "Q", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 35, 90, "W", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 65, 90, "E", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 85, 90, "R", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 115, 90, "T", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 135, 90, "Y", "CM", 1, 1,   RGB(white), RGB(100,100,100)

Text 175, 55, "A", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 195, 55, "S", "CM", 1, 1,    RGB(white), RGB(100,100,100)
Text 220, 55, "D", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 245, 55, "F", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 275, 55, "G", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 295, 55, "H", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 175, 90, "Z", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 195, 90, "X", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 220, 90, "C", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 245, 90, "V", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 275, 90, "B", "CM", 1, 1,   RGB(white), RGB(100,100,100)
Text 295, 90, "N", "CM", 1, 1,   RGB(white), RGB(100,100,100)

'function command lables
Text 15, 286, "F1:Display", " M", 1,  1,  RGB(white), RGB(100,100,100)
Text 110, 286, "F2:Quit", " M", 1, 1,   RGB(white), RGB(100,100,100)
Text 180, 286, "F3:Screen to BMP", "  M", 1, 1,  RGB(white), RGB(100,100, 100)
Text 15, 300, "F4:add to log file",  " M", 1, 1,  RGB(white), RGB(100,100, 100)

'loop or key presses
colorloop:
  a$=Inkey$
  If a$ = "" Then GoTo colorloop
'red foreground
  If Asc(a$) = 49 Then
  fr = fr + 20
    If fr > 255 Then fr = 255
 Text 25, 30, "   ", "C", 4, 1
 Text 25, 30, Str$(fr), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 50 Then
  fr = fr + 1
  If fr > 255 Then fr = 255
  Text 25, 30, "   ", "C", 4, 1
  Text 25, 30, Str$(fr), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 113 Then
  fr = fr - 20
    If fr < 0 Then fr = 0
 Text 25, 30, "   ", "C", 4, 1
 Text 25, 30, Str$(fr), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 119 Then
  fr = fr - 1
  If fr < 0 Then fr = 0
  Text 25, 30, "   ", "C", 4, 1
  Text 25, 30, Str$(fr), "C", 4, 1:GoTo colorloop
  EndIf
'green foreground
  If Asc(a$) = 51 Then
  fg = fg + 20
    If fg > 255 Then fg = 255
 Text 75, 30, "   ", "C", 4, 1
 Text 75, 30, Str$(fg), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 52 Then
  fg = fg + 1
  If fg > 255 Then fg = 255
  Text 75, 30, "   ", "C", 4, 1
  Text 75, 30, Str$(fg), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 101 Then
  fg = fg - 20
    If fg < 0 Then fg = 0

 Text 75, 30, "   ", "C", 4, 1
 Text 75, 30, Str$(fg), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 114 Then
  fg = fg - 1
    If fg < 0 Then fg = 0

 Text 75, 30, "   ", "C", 4, 1
 Text 75, 30, Str$(fg), "C", 4,   1:GoTo colorloop
  EndIf


'blue foreground
  If Asc(a$) = 53 Then
  fb = fb + 20
    If fb > 255 Then fb = 255
 Text 125, 30, "   ", "C", 4, 1
 Text 125, 30, Str$(fb), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 54 Then
  fb = fb + 1
  If fb > 255 Then fb = 255

  Text 125, 30, "   ", "C", 4, 1
  Text 125, 30, Str$(fb), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 116 Then
  fb = fb - 20
    If fb < 0 Then fb = 0

 Text 125, 30, "   ", "C", 4, 1
 Text 125, 30, Str$(fb), "C", 4,   1:GoTo colorloop
  EndIf


  If Asc(a$) = 121 Then
  fb = fb - 1
  If fb < 0 Then fb = 0

  Text 125, 30, "   ", "C", 4, 1
  Text 125, 30, Str$(fb), "C", 4, 1:GoTo colorloop
  EndIf
'Red background
  If Asc(a$) = 97 Then
  br = br + 20
    If br > 255 Then br = 255
 Text 185, 30, "   ", "C", 4, 1
 Text 185, 30, Str$(br), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 115 Then
  br = br + 1
  If br > 255 Then br = 255
  Text 185, 30, "   ", "C", 4, 1
  Text 185, 30, Str$(br), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 122 Then
  br = br - 20
  If br < 0 Then br = 0
  Text 185, 30, "   ", "C", 4, 1
  Text 185, 30, Str$(br), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 120 Then
  br = br - 1
  If br < 0 Then br = 0
  Text 185, 30, "   ", "C", 4, 1
  Text 185, 30, Str$(br), "C", 4, 1:GoTo colorloop
  EndIf
'Green background
  If Asc(a$) = 100 Then
  bg = bg + 20
    If bg > 255 Then bg = 255
 Text 235, 30, "   ", "C", 4, 1
 Text 235, 30, Str$(bg), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 102 Then
  bg = bg + 1
  If bg > 255 Then bg = 255
  Text 235, 30, "   ", "C", 4, 1
  Text 235, 30, Str$(bg), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 99 Then
  bg = bg - 20
  If bg < 0 Then bg = 0
  Text 235, 30, "   ", "C", 4, 1
  Text 235, 30, Str$(bg), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 118 Then
  bg = bg - 1
  If bg < 0 Then bg = 0
  Text 235, 30, "   ", "C", 4, 1
  Text 235, 30, Str$(bg), "C", 4, 1:GoTo colorloop
  EndIf
'Blue backfround
  If Asc(a$) = 103 Then
  bb = bb + 20
    If bb > 255 Then bb = 255
 Text 285, 30, "   ", "C", 4, 1
 Text 285, 30, Str$(bb), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 104 Then
  bb = bb + 1
  If bb > 255 Then bb = 255
  Text 285, 30, "   ", "C", 4, 1
  Text 285, 30, Str$(bb), "C", 4, 1:GoTo colorloop
  EndIf

  If Asc(a$) = 98 Then
  bb = bb - 20
  If bb < 0 Then bb = 0
  Text 285, 30, "   ", "C", 4, 1
  Text 285, 30, Str$(bb), "C", 4,   1:GoTo colorloop
  EndIf

  If Asc(a$) = 110 Then
  bb = bb - 1
  If bb < 0 Then bb = 0
  Text 285, 30, "   ", "C", 4, 1
  Text 285, 30, Str$(bb), "C", 4, 1:GoTo colorloop
  EndIf

'render colors when F1 pressed
If Asc(a$) = 145 Then
  Text 0, 120, LT$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 136, LR$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 152, LR$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 168, LM$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 184, LR$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 200, LR$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)
  Text 0, 216, LB$, , 4, 1,  RGB(fr, fg,fb), RGB(br,bg,bb)

  Text 8, 136 ,Chr$(174) + Chr$(174)  +  Chr$(175) + Chr$(175) + Chr$(176)  + Chr$(176) + Chr$(177) + Chr$(177), ,  4, 1,  RGB(fr,fg,fb), RGB(br,bg,bb)
  Text 8, 152 ,Chr$(174) + Chr$(174)  +  Chr$(175) + Chr$(175) + Chr$(176)  +Chr$(176) + Chr$(177) + Chr$(177), ,  4, 1,  RGB(fr,fg,fb), RGB(br,bg,bb)

  Text 10, 184 ,Chr$(178) +  Chr$(178) +  Chr$(219) + Chr$(220) +  Chr$(221) + Chr$(222) + Chr$(223) +  Chr$(177), , 4, 1,  RGB(fr,fg,fb),  RGB(br,bg,bb)
  Text 10, 200 ,Chr$(178) +  Chr$(178) +  Chr$(219) + Chr$(220) +  Chr$(221) +Chr$(222) + Chr$(223) +  Chr$(177), , 4, 1,  RGB(fr,fg,fb),  RGB(br,bg,bb)

  Text 100, 136, LT1$, , 4, 1,   RGB(fr,fg,fb), RGB(br,bg,bb)
  Text 100, 152, LT2$, , 4, 1,   RGB(fr,fg,fb), RGB(br,bg,bb)
  Text 100, 184, LT3$, , 4, 1,   RGB(fr,fg,fb), RGB(br,bg,bb)
  Text 100, 200, LT4$, , 4, 1,   RGB(fr,fg,fb), RGB(br,bg,bb)


'show hex and numeric of rbg
  Text 0, 240, "Foreground: " +  Str$(RGB(fr,fg,fb)) , , 4, 1,  RGB(white), RGB(100,100,100)
  Text 225, 240, Hex$(RGB(fr,fg, fb))) , , 4, 1, RGB(white), RGB(100, 100,100)
  Text 0, 254, "Background: "  +Str$(RGB(br,bg,bb)), , 4, 1,  RGB(white), RGB(100,100,100)
  Text 225, 254, Hex$(RGB(br,bg,bb)),  , 4, 1, RGB(white), RGB(100,100,100)


  GoTo colorloop


EndIf
'F2 to quit
If Asc(a$) = 146 Then End
'F3 to save bmp of screen
If Asc(a$) = 147 Then Save image  "cp_"
'F4 to log rbg values to cp_log.txt
If Asc(a$) = 148 Then
Open "cp_log.txt" For append As #1
Print #1, "Foreground:"
Print #1, Str$(fr) + "," + Str$(fg) + "," + Str$(fb) + " " +Str$(RGB(fr,fg,fb)) + " " +Hex$(RGB(fr,fg,fb))
Print #1, "Background:"
Print #1, Str$(br) + "," + Str$(bg) +"," + Str$(bb) + " "+Str$(RGB(br,bg,bb)) + " " +Hex$(RGB(br,bg,bb))
Print #1, " "
Close #1
EndIf

GoTo colorloop

Thanks

7 Likes

Great program! It will be useful.

As a teenager I coded in Turbo Pascal. The IDE used yellow on blue like this.

3 Likes

I’m glad you like it. Thanks for trying it out for me.

1 Like

My alternative… See all default colour names, random startup colour panel with ability to edit and save a bmp.

3 Likes

Nice. Where can I snag a copy?

I’ll see what I can do, difficult to transfer to my phone…

Here you go, one of my early programs…
cursor keys to change rgb and values (hold up and down to change). S to save a .bmp. Note the end of the program is expecting a menu program “m.bas” to exist. Paste has removed indentation of loops.

'colours

CLS

Box 0,0,80,24,RGB(white),RGB(white)
Print @(84,6)“White”
Box 0,24,80,24,RGB(white),RGB(lightgray)
Print @(84,30)“Lightgray”
Box 0,48,80,24,RGB(white),RGB(gray)
Print @(84,54)“Gray”
Box 0,72,80,24,RGB(white),RGB(black)
Print @(84,78)“Black”
Box 0,96,80,24,RGB(white),RGB(beige)
Print @(84,102)“Beige”
Box 0,120,80,24,RGB(white),RGB(yellow)
Print @(84,126)“Yellow”
Box 0,144,80,24,RGB(white),RGB(gold)
Print @(84,150)“Gold”
Box 0,168,80,24,RGB(white),RGB(orange)
Print @(84,174)“Orange”
Box 0,192,80,24,RGB(white),RGB(pink)
Print @(84,198)“Pink”
Box 0,216,80,24,RGB(white),RGB(brown)
Print @(84,222)“Brown”
Box 0,240,80,24,RGB(white),RGB(salmon)
Print @(84,246)“Salmon”
Box 0,264,80,24,RGB(white),RGB(rust)
Print @(84,270)“Rust”
Box 0,288,80,24,RGB(white),RGB(red)
Print @(84,294)“Red”

Box 160,0,80,24,RGB(white),RGB(magenta)
Print @(244,6)“Magenta”
Box 160,24,80,24,RGB(white),RGB(fuchsia)
Print @(244,30)“Fuchsia”
Box 160,48,80,24,RGB(white),RGB(lilac)
Print @(244,54)“Lilac”
Box 160,72,80,24,RGB(white),RGB(cyan)
Print @(244,78)“Cyan”
Box 160,96,80,24,RGB(white),RGB(cerulean)
Print @(244,102)“Cerulean”
Box 160,120,80,24,RGB(white),RGB(cobalt)
Print @(244,126)“Cobalt”
Box 160,144,80,24,RGB(white),RGB(blue)
Print @(244,150)“Blue”
Box 160,168,80,24,RGB(white),RGB(green)
Print @(244,174)“Green”
Box 160,192,80,24,RGB(white),RGB(midgreen)
Print @(244,198)“Midgreen”
Box 160,216,80,24,RGB(white),RGB(myrtle)
Print @(244,222)“Myrtle”

rd%=Rnd255:gr%=Rnd255:bl%=Rnd*255:loc%=0
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)

Print @(159,276)“Rd”
Print @(213,276)“Gr”
Print @(267,276)“Bl”
Color RGB(green):Print @(162,294)“Arrow keys”;
Color RGB(white):Print " S";
Color RGB(green):Print " or ESC"

Color RGB(green)
Print @(174,276);rd%
Print @(228,276);gr%
Print @(280,276);bl%

Box 160+loc%*20,288,46,3,RGB(green),RGB(green)

Do
k$=Inkey$

If k$=Chr$(131) And loc%<2 Then
Box 160+loc%*54,288,46,3,RGB(black),RGB(black)
Inc loc%
Box 160+loc%*54,288,46,3,RGB(green),RGB(green)
EndIf

If k$=Chr$(130) And loc%>0 Then
Box 160+loc%*54,288,46,3,RGB(black),RGB(black)
loc%=loc%-1
Box 160+loc%*54,288,46,3,RGB(green),RGB(green)
EndIf

If k$=Chr$(129) Then
If loc%=0 And rd%>0 Then
rd%=rd%-2
If rd%<0 Then rd%=0
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(174,276);rd%;" "
EndIf
If loc%=1 And gr%>0 Then
gr%=gr%-2
If gr%<0 Then gr%=0
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(228,276);gr%;" "
EndIf
If loc%=2 And bl%>0 Then
bl%=bl%-2
If bl%<0 Then bl%=0
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(280,276);bl%;" "
EndIf
EndIf

If k$=Chr$(128) Then
If loc%=0 And rd%<255 Then
rd%=rd%+2
If rd%>255 Then rd%=255
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(174,276);rd%;" "
EndIf
If loc%=1 And gr%<255 Then
gr%=gr%+2
If gr%>255 Then gr%=255
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(228,276);gr%;" "
EndIf
If loc%=2 And bl%<255 Then
bl%=bl%+2
If bl%>255 Then bl%=255
Box 160,248,158,24,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(280,276);bl%;" "
EndIf
EndIf

If K$=Chr$(115) Then
Save image “cols.bmp”,0,0,319,319
Play tone 1000,2000,20
Pause 20
Play tone 3000,3000,20
EndIf

Loop Until k$=Chr$(27)

Clear
Run “m”

4 Likes

@digitaldreams,Thank you for sharing this! I’m having a lot of fun trying the programs shared by others.

I had to make two changes to the program to get it to run.

  1. The first was (i think) due to a text encoding issue. The quotes used in a lot of the program were some kind of fancy double quotes that are different on the left and the right of the text (maybe you put it through a word processor that does that automatically?) I replaced them with standard ASCII double quote. Before changing it on the PicoCalc it was showing up as the letter b for some reason.
  2. I had to add a comma to the Box statements because it was expecting a width before the border and fill colors. I learned from looking at another example that you can just leave it blank but have to put the comma so it knows to skip it and use the default of 1 in this case. I’m guessing maybe you’re on a different version of picomite? I’m using 6.00.02
BOX X, Y, X1, Y1, LineWidth, BorderColor, FillColor

This slightly modified code worked for me on my PicoCalc

'colours by DigitalDreams (picocalc forum)
'cursor keys to change rgb and values
'(hold up and down to change).
'S to save a .bmp

CLS

Box 0,0,80,24,,RGB(white),RGB(white)
Print @(84,6)"White"
Box 0,24,80,24,,RGB(white),RGB(lightgray)
Print @(84,30)"Lightgray"
Box 0,48,80,24,,RGB(white),RGB(gray)
Print @(84,54)"Gray"
Box 0,72,80,24,,RGB(white),RGB(black)
Print @(84,78)"Black"
Box 0,96,80,24,,RGB(white),RGB(beige)
Print @(84,102)"Beige"
Box 0,120,80,24,,RGB(white),RGB(yellow)
Print @(84,126)"Yellow"
Box 0,144,80,24,,RGB(white),RGB(gold)
Print @(84,150)"Gold"
Box 0,168,80,24,,RGB(white),RGB(orange)
Print @(84,174)"Orange"
Box 0,192,80,24,,RGB(white),RGB(pink)
Print @(84,198)"Pink"
Box 0,216,80,24,,RGB(white),RGB(brown)
Print @(84,222)"Brown"
Box 0,240,80,24,,RGB(white),RGB(salmon)
Print @(84,246)"Salmon"
Box 0,264,80,24,,RGB(white),RGB(rust)
Print @(84,270)"Rust"
Box 0,288,80,24,,RGB(white),RGB(red)
Print @(84,294)"Red"

Box 160,0,80,24,,RGB(white),RGB(magenta)
Print @(244,6)"Magenta"
Box 160,24,80,24,,RGB(white),RGB(fuchsia)
Print @(244,30)"Fuchsia"
Box 160,48,80,24,,RGB(white),RGB(lilac)
Print @(244,54)"Lilac"
Box 160,72,80,24,,RGB(white),RGB(cyan)
Print @(244,78)"Cyan"
Box 160,96,80,24,,RGB(white),RGB(cerulean)
Print @(244,102)"Cerulean"
Box 160,120,80,24,,RGB(white),RGB(cobalt)
Print @(244,126)"Cobalt"
Box 160,144,80,24,,RGB(white),RGB(blue)
Print @(244,150)"Blue"
Box 160,168,80,24,,RGB(white),RGB(green)
Print @(244,174)"Green"
Box 160,192,80,24,,RGB(white),RGB(midgreen)
Print @(244,198)"Midgreen"
Box 160,216,80,24,,RGB(white),RGB(myrtle)
Print @(244,222)"Myrtle"

rd%=Rnd*255:gr%=Rnd*255:bl%=Rnd*255:loc%=0
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)

Print @(159,276)"Rd"
Print @(213,276)"Gr"
Print @(267,276)"Bl"
Color RGB(green):Print @(162,294)"Arrow keys";
Color RGB(white):Print " S";
Color RGB(green):Print " or ESC"

Color RGB(green)
Print @(174,276);rd%
Print @(228,276);gr%
Print @(280,276);bl%

Box 160+loc%*20,288,46,3,,RGB(green),RGB(green)

Do
k$=Inkey$

If k$=Chr$(131) And loc%<2 Then
Box 160+loc%*54,288,46,3,,RGB(black),RGB(black)
Inc loc%
Box 160+loc%*54,288,46,3,,RGB(green),RGB(green)
EndIf

If k$=Chr$(130) And loc%>0 Then
Box 160+loc%*54,288,46,3,,RGB(black),RGB(black)
loc%=loc%-1
Box 160+loc%*54,288,46,3,,RGB(green),RGB(green)
EndIf

If k$=Chr$(129) Then
If loc%=0 And rd%>0 Then
rd%=rd%-2
If rd%<0 Then rd%=0
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(174,276);rd%;" "
EndIf
If loc%=1 And gr%>0 Then
gr%=gr%-2
If gr%<0 Then gr%=0
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(228,276);gr%;" "
EndIf
If loc%=2 And bl%>0 Then
bl%=bl%-2
If bl%<0 Then bl%=0
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(280,276);bl%;" "
EndIf
EndIf

If k$=Chr$(128) Then
If loc%=0 And rd%<255 Then
rd%=rd%+2
If rd%>255 Then rd%=255
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(174,276);rd%;" "
EndIf
If loc%=1 And gr%<255 Then
gr%=gr%+2
If gr%>255 Then gr%=255
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(228,276);gr%;" "
EndIf
If loc%=2 And bl%<255 Then
bl%=bl%+2
If bl%>255 Then bl%=255
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
Print @(280,276);bl%;" "
EndIf
EndIf

If K$=Chr$(115) Then
Save image "cols.bmp",0,0,319,319
Play tone 1000,2000,20
Pause 20
Play tone 3000,3000,20
EndIf

Loop Until k$=Chr$(27)

'Clear
'Run "m"

2 Likes

So for one of my programs I’m trying to create an option for the user to input an RGB color code / name of a color (white,blue,yellow,etc) to change the color of the text displayed on a status bar, I got the input part working but was curious how I draw colored vars

Id like a box under the status bar at the bottom that always shows as white, how would i do that?

Yes that’s very odd !. I used windows notepad to copy here… The following line looks perfect as I enter it into this reply (again copied from notepad)

Print @(84,126)“Yellow”
(yes it’s corrupted too, zoom in)

How was the first post in some kind of box ?, maybe that preserves some formatting.

The box command is odd, written in a an early version of MMBasic from March this year. I always update to the latest version though and the program is running fine still… Looking at my program on the picocalc the two commas are there !, stripped out by this reply box.

How did you insert the code box ?, this editor is corrupting copied programs…

To post a code block on this forum you would put three grave accents ` or three tildes ~ in a row to open and close the code box. This is where I found how to do that Extended Syntax | Markdown Guide

1 Like

Do you mean something like this or something text based?

1 Like

You can also click this icon if you’re replying on desktop. Not sure if it works on mobile devices.

1 Like

Test…

'colours

CLS

Box 0,0,80,24,,RGB(white),RGB(white)
Print @(84,6)"White"
Box 0,24,80,24,,RGB(white),RGB(lightgray)
Print @(84,30)"Lightgray"
Box 0,48,80,24,,RGB(white),RGB(gray)
Print @(84,54)"Gray"
Box 0,72,80,24,,RGB(white),RGB(black)
Print @(84,78)"Black"
Box 0,96,80,24,,RGB(white),RGB(beige)
Print @(84,102)"Beige"
Box 0,120,80,24,,RGB(white),RGB(yellow)
Print @(84,126)"Yellow"
Box 0,144,80,24,,RGB(white),RGB(gold)
Print @(84,150)"Gold"
Box 0,168,80,24,,RGB(white),RGB(orange)
Print @(84,174)"Orange"
Box 0,192,80,24,,RGB(white),RGB(pink)
Print @(84,198)"Pink"
Box 0,216,80,24,,RGB(white),RGB(brown)
Print @(84,222)"Brown"
Box 0,240,80,24,,RGB(white),RGB(salmon)
Print @(84,246)"Salmon"
Box 0,264,80,24,,RGB(white),RGB(rust)
Print @(84,270)"Rust"
Box 0,288,80,24,,RGB(white),RGB(red)
Print @(84,294)"Red"

Box 160,0,80,24,,RGB(white),RGB(magenta)
Print @(244,6)"Magenta"
Box 160,24,80,24,,RGB(white),RGB(fuchsia)
Print @(244,30)"Fuchsia"
Box 160,48,80,24,,RGB(white),RGB(lilac)
Print @(244,54)"Lilac"
Box 160,72,80,24,,RGB(white),RGB(cyan)
Print @(244,78)"Cyan"
Box 160,96,80,24,,RGB(white),RGB(cerulean)
Print @(244,102)"Cerulean"
Box 160,120,80,24,,RGB(white),RGB(cobalt)
Print @(244,126)"Cobalt"
Box 160,144,80,24,,RGB(white),RGB(blue)
Print @(244,150)"Blue"
Box 160,168,80,24,,RGB(white),RGB(green)
Print @(244,174)"Green"
Box 160,192,80,24,,RGB(white),RGB(midgreen)
Print @(244,198)"Midgreen"
Box 160,216,80,24,,RGB(white),RGB(myrtle)
Print @(244,222)"Myrtle"

rd%=Rnd*255:gr%=Rnd*255:bl%=Rnd*255:loc%=0
Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)

Print @(159,276)"Rd"
Print @(213,276)"Gr"
Print @(267,276)"Bl"
Color RGB(green):Print @(162,294)"Arrow keys";
Color RGB(white):Print " S";
Color RGB(green):Print " or ESC"

Color RGB(green)
Print @(174,276);rd%
Print @(228,276);gr%
Print @(280,276);bl%

Box 160+loc%*20,288,46,3,,RGB(green),RGB(green)

Do
k$=Inkey$

If k$=Chr$(131) And loc%<2 Then
 Box 160+loc%*54,288,46,3,,RGB(black),RGB(black)
 Inc loc%
 Box 160+loc%*54,288,46,3,,RGB(green),RGB(green)
EndIf

If k$=Chr$(130) And loc%>0 Then
 Box 160+loc%*54,288,46,3,,RGB(black),RGB(black)
 loc%=loc%-1
 Box 160+loc%*54,288,46,3,,RGB(green),RGB(green)
EndIf

If k$=Chr$(129) Then
 If loc%=0 And rd%>0 Then
  rd%=rd%-2
  If rd%<0 Then rd%=0
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(174,276);rd%;" "
 EndIf
 If loc%=1 And gr%>0 Then
  gr%=gr%-2
  If gr%<0 Then gr%=0
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(228,276);gr%;" "
 EndIf
 If loc%=2 And bl%>0 Then
  bl%=bl%-2
  If bl%<0 Then bl%=0
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(280,276);bl%;" "
 EndIf
EndIf

If k$=Chr$(128) Then
 If loc%=0 And rd%<255 Then
  rd%=rd%+2
  If rd%>255 Then rd%=255
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(174,276);rd%;" "
 EndIf
 If loc%=1 And gr%<255 Then
  gr%=gr%+2
  If gr%>255 Then gr%=255
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(228,276);gr%;" "
 EndIf
 If loc%=2 And bl%<255 Then
  bl%=bl%+2
  If bl%>255 Then bl%=255
  Box 160,248,158,24,,RGB(rd%,gr%,bl%),RGB(rd%,gr%,bl%)
  Print @(280,276);bl%;" "
 EndIf
EndIf

If K$=Chr$(115) Then
 Save image "cols.bmp",0,0,319,319
 Play tone 1000,2000,20
 Pause 20
 Play tone 3000,3000,20
EndIf

Loop Until k$=Chr$(27)

Clear
Run "m"

Works !

1 Like

No, missing in Android… the three tildes should work though…

Test
Test
Test

Done