English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 08 May 2021, 15:38   #1
LessNick
Amiga
 
LessNick's Avatar
 
Join Date: May 2021
Location: RB
Posts: 13
Roll eyes (sarcastic) NPrint colour output

Hello AGAin o/

Is it possible to set color for ouput with NPrint (CLI)?

I search a lot of documentation, forum & google
But the only mention is the colour command.

As I understand it, it is used to select a color for working with bitmap olny.

I try use CLI escrape trick with echo like "*e[", but it looks like this is only used by the echo command itself.

Perhaps there is an option to use ESC sequence like CHR$(27) + codes

But honestly I haven't found anything similar.
LessNick is offline  
Old 10 May 2021, 14:45   #2
Zener
Registered User
 
Zener's Avatar
 
Join Date: Jan 2009
Location: Barcelona / Spain
Posts: 432
If you are using a window you could try with WColour command
Zener is offline  
Old 10 May 2021, 15:10   #3
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Quote:
Originally Posted by LessNick View Post
But the only mention is the colour command.

As I understand it, it is used to select a color for working with bitmap olny.
Indeed, this is used for writing characters directly to a bitmap.

Quote:
I try use CLI escrape trick with echo like "*e[", but it looks like this is only used by the echo command itself.
Yep, typically NPrint will simply directly output whatever characters are in the quotes and no interpretation is done. The escape codes are interpreted by the console, but it's difficult to enter the ASCII characters directly for use by Echo etc., which is why the special sequence is required.

Quote:
Perhaps there is an option to use ESC sequence like CHR$(27) + codes
That should actually work, since you're then presenting the escape character directly to the console to interpret. For example:
Code:
NPrint Chr$(27), "[1mHello Bold World!"
should print the phrase in bold. It's a little clumsy though, so perhaps having some preset formatting strings might be better if you're going to be doing a lot of formatting?
Code:
bold$ = Chr$(27) + "[1m"
italic$ = Chr$(27) + "[3m"
nobold$ = Chr$(27) + "[22m"
highlight$ = Chr$(27) + "[33m"

; Rest of your program here

NPrint bold$, "Bold", italic$, " Bold-Italic", nobold$, highlight$, " Highlighted italic"
End
Daedalus is offline  
Old 10 May 2021, 15:36   #4
LessNick
Amiga
 
LessNick's Avatar
 
Join Date: May 2021
Location: RB
Posts: 13
Thumbs up

Quote:
Originally Posted by Zener View Post
If you are using a window you could try with WColour command
Thanks a lot! This is exactly what I was looking for.
LessNick is offline  
Old 10 May 2021, 15:46   #5
LessNick
Amiga
 
LessNick's Avatar
 
Join Date: May 2021
Location: RB
Posts: 13
Red face

Quote:
Originally Posted by Daedalus View Post
For example:
Code:
NPrint Chr$(27), "[1mHello Bold World!"
should print the phrase in bold. It's a little clumsy though, so perhaps having some preset formatting strings might be better if you're going to be doing a lot of formatting?
[code]
Thank you very much for the clarification, now it has become a little clearer.

Fun fact though. If you output all this to the console that BlitzBasic itself opens, everything works ok:



But if use the NoCli command and open an own Window, then NPrint show a square(unknown symbol code 27), and then [1m
Attached Thumbnails
Click image for larger version

Name:	019_.png
Views:	160
Size:	1.1 KB
ID:	71862  
LessNick is offline  
Old 10 May 2021, 16:04   #6
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Yep, that's to be expected. The difference is that the console window is effectively text-based, and it's the console that interprets the escape codes, not the actual window. You can only really interact with it in terms of text. If you open your own window, it's essentially a blank graphics object, not a text window like the console, so it behaves more like a bitmap.
Daedalus is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga 1000 composite video output (colour?) vimfuego support.Hardware 11 22 April 2021 14:38
Will this output full colour range ? kipper2k support.Hardware 3 02 July 2011 16:14
Colour issue AtlasRapture support.WinUAE 7 17 July 2010 11:39
Colour space absence support.Hardware 5 04 June 2009 14:57
A500 RCA output: blue colour problem Old Fool support.Hardware 14 18 February 2009 08:48

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:12.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07003 seconds with 14 queries