color for print in output pane

50 views
Skip to first unread message

Michel Sauvard

unread,
May 18, 2020, 4:34:47 PM5/18/20
to scite-interest
Hello

Is there a way to print in the output in color.
My purpose is to outline errors.
Either giving the color or with an error style like "Lua: error"
I tryed scite.SendOutput. SCI_INSERTTEXT works but I dont see anything about color, SCI_ADDTEXT do nothing and SCI_ADDSTYLESDTEXT trigger an error "not scriptable"

Best regards

Neil Hodgson

unread,
May 18, 2020, 5:54:30 PM5/18/20
to scite-i...@googlegroups.com
Michel Sauvard:

Is there a way to print in the output in color.

   Turn on lexer.errorlist.escape.sequences and try some escape sequences.

   Neil

Michel Sauvard

unread,
May 19, 2020, 3:29:44 AM5/19/20
to scite-interest
Hello

The colors are quite dull but it works enough.
Only Bold and 8 foreground colors are possible.

In case someone is interested here is my test:
for ii = 1,99,1 do
  print ("\27["..ii.."m"..ii.."\27[0m")
end

Best regards

BugFix@AutoIt

unread,
May 15, 2022, 4:04:52 AMMay 15
to scite-interest
I've tried it with SciTE v 5.2.0.

lexer.errorlist.escape.sequences=1

I have run the Lua code from the previous post - but it shows no effect. Only numbers are displayed.
Any suggestions? 

Neil Hodgson

unread,
May 15, 2022, 5:46:47 PMMay 15
to scite-i...@googlegroups.com
BugFix@AutoIt:

> I've tried it with SciTE v 5.2.0.
>
> lexer.errorlist.escape.sequences=1
>
> I have run the Lua code from the previous post - but it shows no effect. Only numbers are displayed.

Just tried on Mac and Windows and shows for me.
It should show ‘1’ bold and ’31’ to ’37’ with colours plus a pinkish background.
Try reverting any customized settings - download a new copy and clear your user settings.

Another approach to the original issue is to mimic another style of error message. gcc’s is popular:
path:lineNumber:message

like
bad.py:23:bad stuff

or Microsoft’s (“error” is literal):
path(line): error text
x.bat(2): error Not available

The path and line number don’t have to be real
x:0:failed

Neil

BugFix@AutoIt

unread,
May 16, 2022, 5:03:30 AMMay 16
to scite-interest
Thank you Neil.

It works for me on Windows with the foreground color setting (default and bold). But all colors have this ugly background color. I have not found a way to change this.

Here my test script and result:

fg = {
red='\27[31m',
redbold='\27[31;1m',
green='\27[32m',
greenbold='\27[32;1m',
yellow='\27[33m',
yellowbold='\27[33;1m',
blue='\27[34m',
bluebold='\27[34;1m',
pink='\27[35m',
pinkbold='\27[35;1m',
cyan='\27[36m',
cyanbold='\27[36;1m',
white='\27[37m',
whitebold='\27[37;1m',
def='\27[0m'}

print(fg.red..'List '..fg.cyan..'of '..fg.bluebold..'colors'..fg.pinkbold..'!\n'..fg.def)

for color, seq in pairs (fg) do
    if tostring(color) ~= 'def' then print(seq..tostring(color)..fg.def) end
end

esc_seq_color_SciTE.png

Reply all
Reply to author
Forward
0 new messages