Changing font color in tcl programming - windows

I am new to Tcl language. I have a script I am trying to change the font color. What I have so far isn't working
puts "\033\[1;31m";
puts "Color Should change."
puts "\033\[0m";
What I am getting is an ascii arrow[;31m i was expecting to see the font color change when i ran my script.

Related

Correcting Syntax Highlight files for Notepad++

I was trying to add a syntax highlight file to Notepad++ containing syntax highlights for AutoHotkey, I followed what was in this here https://autohotkey.com/boards/viewtopic.php?f=7&t=50
but of course when I've imported it and set the defined language thing, it gives me wrong colors all over the text making white background around the text like this
How can I correct this so it's giving me the proper syntax highlights without white background on the text? it looks horrible just looking at it.
Right click the background color in the Styler Dialogs:
The transparency mark won't be remembered, but the style will.

terminal top command different text colors

on OSX, when I run top sometimes I see some different colors, namely black text....
What does it mean?
What bash setting do I need to change to make these a different color? black is too hard to read with my setup.
It turns out that it was a simple text color in the terminal preferences, I think the title of the setting was 'bold text'

Highlighting Vim text with black background when ANSI colors are off

I'm on OSX. I turned ANSI colors off in Terminal.app. This is great, but now visual selections are no longer highlighted. I'd like them to be simply inverted with a black background and white text. I've tried
hi Visual ctermfg=15 ctermbg=0
hi VisualNOS ctermfg=15 ctermbg=0
but nothing's happening. Any ideas?
Without ANSI colors support there is no real point defining foreground and background colors.
What you are looking for is:
hi Visual cterm=reverse
hi VisualNOS cterm=underline
See :help highlight-cterm.

How to change font color for comments in Vim

I'd like to change the default font color for comments, which is dark blue to slightly yellow color. It is difficult to read on the black background. I'm using xfce4-terminal, not gvim with GUI.
How do I change only this one color?
So far, I have changed the settings in my ~/.profile file according to "256 colors in vim" using:
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
and
set t_Co=256
in ~/.vimrc.
Most well-behaving colorschemes will respect the background setting.
set background=dark
would change the color of comments from dark blue to light blue, when using the default colorscheme.
:hi Comment guifg=#ABCDEF
Pick your color! If using a color terminal, replace guifg=#ABCDEF with ctermfg=N with N being a color number.
Also type :help :hi for more information.
hi Comment ctermfg=LightBlue
Add this to your .vimrc file which is either in your ~ or the /etc/vim directory. This will make it permanent. I haven't tested this with gvim.
I also have set background=light before I set comment color. I like all the colors it created except for the comments.
After searching you can find a decent reference to Vim regarding this issue especially, at "256 colors in vim".
Start with:
:verbose hi
when actually inside Vim, and editing a file.
Then check out how all of the variables have metadata associated with them. Data returned from there makes it real easy to add the desired modifier types into .vimrc. As an example, these are updates I recently added in order to get rid of dark blue, and not have to be tormented by the light blue:
set number background=dark
syntax on
highlight Comment ctermfg=119
highlight Identifier ctermfg=99AA00
If the objective is to make it more readable in the dark background of the text console, the command below is a wonderful option and easy to remember:
:colorscheme evening
But be advised, it will change other element's colors.
See "Syntax Highlighting In VIm".
set background=dark
or
set bg=dark
are the best solution for VIM users!
There are various color schemes in Vim. The "default" color scheme displays comments in a blue color, which makes it hard to read against a black terminal background. I prefer to use the "desert" color scheme which displays in readable colors.
To enable the "desert" color scheme in Vim, use the command :color desert. If you want to go back to the default use :color default.
You can even update your ~/.vimrc with your preferred color scheme using:
echo 'color desert' >> ~/.vimrc
I had the same question and wanted to edit my Comment color from LightBlue to something more toned down, and, following #Benoit's answer, this worked for me:
hi Comment ctermbg=0 ctermfg=DarkGrey
I saved it in my ~/.vimrc file.
0 = Black Background, i.e. Color Terminal Background: ctermbg=0, and the Foreground text is DarkGrey, i.e. Color Terminal Foreground: ctermfg=DarkGrey.
You can check your color scheme first using:
:!ls $VIMRUNTIME/colors
then try whichever suits you best.

How can I use variables to DRY up Vim colorthemes

I would like to tidy up my Vim color scheme file, by replacing #ABCDEF colors
with variables. For example, I would like to replace this:
highlight String guifg=#61CE3C
highlight Identifier guifg=#61CE3C
highlight Type guifg=#84A7C1
with something like this (pseudo-code vimscript):
my_string =#61CE3C
my_type =#84A7C1
highlight String guifg=my_string
highlight Identifier guifg=my_string
highlight Type guifg=my_type
I wasn't sure whether vimscript considers the hex color to be a string, or a
hexadecimal number. Apparently it's a string, cause this seems to work:
:highlight Normal guifg='#ffffff'
So I thought I'd try this:
:let my_color='#ffffff'
:highlight Normal guifg=my_color
But this gives the error "E254: Cannot allocate color my_color". Can anyone
suggest a way to make this work?
Since :highlight doesn't accept a variable as an argument, you have to build the command to run as an expression and then evaluate it with the :execute command.
:let my_color='#ffffff'
:exe 'highlight Normal guifg=' . my_color
As jamessan has said, you need to use :exe to do this. I found the general syntax for the colour scheme files a bit difficult to manage, so I made my own, which you may be interested in. I find it a lot more maintainable, but you may still find it a bit too verbose, in which case see the alternative at the end of this answer.
Rather than writing the long :hi lines, you create a dictionary along the lines of:
" Unspecified colours default to NONE, EXCEPT cterm(.*) which default to matching gui(.*)
" ctermfg will default to 'Blue' and ctermbg to 'NONE' if gui(.*) are RGB
"
" In most cases, only GUIFG is therefore important unless support for Black and White
" terminals is essential
let ColourAssignment['Normal'] = {"GUIFG": 'White', "GUIBG": 'Black'}
let ColourAssignment['Comment'] = {"GUIFG": '#00ff00'}
As mentioned in the comment, all unspecified parts assume sensible defaults, so you don't have to do the common:
:hi Comment guifg=green ctermfg=green guibg=black ctermfg=black
repetition. You can also (of course) put variables in place of the '#00ff00' bit if you want.
It's currently designed around dark background colour schemes: for light background colour schemes, it automatically chooses an appropriate colour (it makes bright colours darker basically) unless you override it, but if you prefer light background colour schemes, it wouldn't be too hard to change so that the default is light.
The other advantage of it is that it comes with a syntax highlighting file that automatically highlights the "ColourAssignment" bit in the colour that you've selected.
Anyway, if that's any interest to you, you can get it from here.
An alternative you could use would be to create a command like this:
command! -nargs=+ Hi call CustomHighlighter(<f-args>)
function! CustomHighlighter(name, ...)
let colour_order = ['guifg', 'guibg']
let command = 'hi ' . a:name
if (len(a:000) < 1) || (len(a:000) > (len(colour_order)))
echoerr "No colour or too many colours specified"
else
for i in range(0,len(a:000)-1)
let command .= ' ' . colour_order[i] . '=' . a:000[i]
endfor
exe command
endif
endfunc
You could then use:
Hi Comment #00ff00
Hi String Yellow
Hi Normal White Black

Resources