Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String color in IDE
#21
Sorry about the problem you ran into bplus, great discussion on solutions. Some pretty valuable stuff here.
Reply
#22
Yes but we kinda drifted off topic, not real sorry ;-)) because there is some good stuff here!
b = b + ...
Reply
#23
@Terry - good to be reminded in case I need it. Here is another explanation (I find the English page confusing): FAT32 + Co

This is what it looks like for me today:
Standard hard drive 500GB divided into C:\ - 200GB NTFS system drive, and extended partition with a logical drive D:\ - 300GB NTFS for data, MS Office, programming, Photoshop, etc.

The 1st external HD with 2TB, divided into 4 logical drives:
E:\ - 300GB NTFS (too big) system backup
F:\ - 360GB NTFS backup of all important data from D:\
G:\ - 1.3TB NTFS data, movies, etc
H:\ - 50GB FAT32
I:\DVD/burner

The 2nd external HD with 320GB, divided into 2 logical drives
J:\ - 100GB NTFS for songs
K:\ - 220GB NTFS for videos, documentation from Arte etc.

[Image: Laufwerke2024-03-13.jpg]
Reply
#24
I agree bplus. I had an issue with a virus warning using qb64pe and the community here was extremely helpful in tracking down the cause and providing the solution. 

As for the topic of this thread, I don't think I framed the issue right and suspect the IDE can not do what I was hoping it could. Nevertheless learned some stuff on accessing color for output to the screen. So thanks people.
Reply
#25
(03-13-2024, 04:00 PM)Dimster Wrote: As for the topic of this thread, I don't think I framed the issue right and suspect the IDE can not do what I was hoping it could. Nevertheless learned some stuff on accessing color for output to the screen. So thanks people.
@Dimster - the IDE sets any color you want. Here is a color table. This allows you to make the IDE colorful (quietschbunt in German  Big Grin  ).
Reply
#26
OK here is more color stuff ;-))
Code: (Select All)
_Title "Color CONST for _RGBA32(red, green, blue, alpha)"

'>>>>>>>>>>>> test your colors here
'>>>>>>>>>>>> then create and name Hex string CONSTs if you want to the Clipboard

Screen _NewImage(800, 600, 32)
_ScreenMove _Middle
If _Clipboard$ <> "" Then
    Input "Clear clipboard? enter y for yes "; w$
    If w$ = "y" Then _Clipboard$ = ""
End If
Do
    Cls
    Print "Enter 4 numbers (0-255) for _RGBA32( red, green, blue, alpha)  you want to test "
    Input "(Don't forget commas) "; r, g, b, a
    MakeConst$ = "&H" + Right$(String$(8, "0") + Hex$(_RGBA32(r, g, b, a)), 8)
    Line (90, 300)-(710, 590), , B
    Line (100, 310)-(700, 580), Val(MakeConst$), BF
    Print "Use this Hex string for color CONST: "; MakeConst$
    Input "  Press c enter to add to ClipBoard, press q enter to quit, just enter to continue.."; w$
    If w$ = "c" Then
        Input "Name your CONST "; cname$
        _Clipboard$ = _Clipboard$ + Chr$(10) + "CONST " + cname$ + "~& = " + MakeConst$
    End If
    If w$ = "q" Then System
Loop

'sample from clipboard
Const invisibleRed~& = &H00FF0000
Const barelyBlue~& = &H0A0000FF


Const anotherRed~& = &HFFC81E28

Another color clipper.
b = b + ...
Reply
#27
Another color picker by keys for adding subtracting r, g, b
Code: (Select All)
_Title "RGB Color Values and Chart:   key e | r changes red, f | g changes green, v | b changes blue "
'B+ 2019-03-01 trnslated from
'color chart.bas SmallBASIC modified 2015-04-27
'2015-04-28 a work in progress MGA/B+

Const xmax = 700
Const ymax = 620
Dim c As _Unsigned Long 'type for color variables
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 300, 100

r = 125: g = 125: b = 125
rect 0, 0, 512, 80, _DefaultColor
frect 10, 10, 502, 70, _RGB32(r, g, b)
Color _RGB32(255, 0, 0): Locate 7, 7: Print "e-/r+ for red  "
Color _RGB32(0, 255, 0): Locate 7, 27: Print "f-/g+ for green"
Color _RGB32(0, 0, 255): Locate 7, 47: Print "v-/+b for blue"
Color _RGB32(255, 255, 255): Locate 9, 2: Print " 0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15   col*16+15 = c"
Locate 11, 67: Print "_rgb32(c,c,c)"
Locate 13, 67: Print "_rgb32(c,0,0)"
Locate 15, 67: Print "_rgb32(0,c,0)"
Locate 17, 67: Print "_rgb32(0,0,c)"
Locate 19, 67: Print "_rgb32(c,c,0)"
Locate 21, 67: Print "_rgb32(c,0,c)"
Locate 23, 67: Print "_rgb32(0,c,c)"
Locate 25, 67: Print "_rgb32(255,c,0)"
Locate 27, 67: Print "_rgb32(255,0,c)"
Locate 29, 67: Print "_rgb32(c,255,0)"
Locate 31, 67: Print "_rgb32(0,255,c)"
Locate 33, 67: Print "_rgb32(c,0,255)"
Locate 35, 67: Print "_rgb32(0,c,255)"

sqx = 32: sqy = 32: yoff = 173
For i = 0 To 207
    row = Int(i / 16): col = i Mod 16
    cx = sqx * col: cy = sqy * row + yoff
    c = col * 16 + 15
    If i > -1 And i < 16 Then c = _RGB32(c, c, c)
    If i > 15 And i < 32 Then c = _RGB32(c, 0, 0)
    If i > 31 And i < 48 Then c = _RGB32(0, c, 0)
    If i > 47 And i < 64 Then c = _RGB32(0, 0, c)
    If i > 63 And i < 80 Then c = _RGB32(c, c, 0)
    If i > 79 And i < 96 Then c = _RGB32(c, 0, c)
    If i > 95 And i < 112 Then c = _RGB32(0, c, c)
    If i > 111 And i < 128 Then c = _RGB32(255, c, 0)
    If i > 127 And i < 144 Then c = _RGB32(255, 0, c)
    If i > 143 And i < 160 Then c = _RGB32(c, 255, 0)
    If i > 159 And i < 176 Then c = _RGB32(0, 255, c)
    If i > 175 And i < 192 Then c = _RGB32(c, 0, 255)
    If i > 191 And i < 208 Then c = _RGB32(0, c, 255)
    frect cx + 8, cy - 20, cx + 8 + sqx - 1, cy - 20 + sqy - 1, c
Next
k$ = " "
While Asc(k$) <> 27
    Color _RGB32(255, 0, 0): Locate 7, 12: Print "    "
    Locate 7, 12: Print r
    Color _RGB32(0, 255, 0): Locate 7, 32: Print "    "
    Locate 7, 32: Print g
    Color _RGB32(0, 0, 255): Locate 7, 52: Print "    "
    Locate 7, 52: Print b
    Color _RGB32(255, 255, 255)
    rect 0, 0, 512, 80, _DefaultColor
    frect 10, 10, 502, 70, _RGB32(r, g, b)
    k$ = InKey$
    While Len(k$) = 0
        k$ = InKey$
    Wend
    If k$ = "e" Then r = r - 5: If r < 0 Then r = 0
    If k$ = "r" Then r = r + 5: If r > 255 Then r = 255
    If k$ = "f" Then g = g - 5: If g < 0 Then g = 0
    If k$ = "g" Then g = g + 5: If g > 255 Then g = 255
    If k$ = "v" Then b = b - 5: If b < 0 Then b = 0
    If k$ = "b" Then b = b + 5: If b > 255 Then b = 255
    _Display 'stop flickering
    _Limit 30 'save cpu fan
Wend

Sub rect (x1, y1, x2, y2, c As _Unsigned Long)
    Line (x1, y1)-(x2, y2), c, B
End Sub
Sub frect (x1, y1, x2, y2, c As _Unsigned Long)
    Line (x1, y1)-(x2, y2), c, BF
End Sub
b = b + ...
Reply
#28
Thanks, this is getting really colorful. I understand the majority of all these glorious ways to get color. I do have a number of different IDE schemes, plus a lot of colorful displays when a program is running. So what I have been trying to do is find a way to have the screen upon which I write code (calling this the IDE screen) to display the color of strings on this IDE screen, in the color which the code is calling for the graphic screen to display.

If you go to Options on the IDE screen, select IDE colors, then select Strings, you set the color for the string "Hello World". If I write code like 

$Color:32
Color Blue
Print" The sky is blue"  <--- this string comes out in the color set in the IDE "Hello World" color. To actually see how the blue string looks I either need to run the code and see it on the graphic screen or go back to the IDE color option, select strings, select blue and I'll see it on the IDE screen. But the all the other strings in my code will also turn blue plus the blue remains the default setting.


If you have code like

$Color:32
Color White
Print" Clouds";
Color Black
Print "mainly float high in the ";
Color Blue
Print "sky"

Not really very helpful to use the IDE string color setting once for each color as you will not see all 3 colors together unless you run the code and see it on the graphic screen.


What I was hoping to find, which I now believe doesn't exist, is a way for the IDE screen to actually color up the string following the color command rather than have it in the string color set in the IDE color options for strings.

So that 
Color White
Print "Clouds", would have the word PRINT in the KEYWORDS color set in IDE Color but the string "Clouds" would now show in White and not the IDE Color set for strings. In this way I could actually see the effect of all 3 colors in my code and would not need to run the code or mess around with the IDE string color setting.
Reply
#29
What you're looking for is not possible in our IDE as it is a pure SCREEN 0 application limited to 15 different color attributes. Some are used for frame/scroller/menu rendering, the remaining are used for the syntax highlighting.

Also your logic is not bullet proof, imagine your code example but modified with GOTOs or SUB calls, so that the COLOR command is no longer in line with the PRINTs

$Color:32
SetColor White
Print" Clouds";
SetColor Black
Print "mainly float high in the ";
SetColor Blue
Print "sky"

SUB SetColor (col~&)
COLOR col~&
END SUB

So how the IDE should know which is the current COLOR at which PRINT without actually running the code?

And I hardly doubt you'll find any IDE out there which is able to do what you want. You've to use some external tool or color table to look up the colors.
Reply
#30
I just want to have a color option for LABELS...

NORMAL TEXT
NUMBERS
STRINGS
METACOMMANDS
COMMENTS
BACKGROUND
CURRENT LINE BACKGROUND
BRACKETS
MENUS

.... but noooooooooo LABELS!

Pete Smile
Reply




Users browsing this thread: 3 Guest(s)