How can I write colored text to an IRC channel with Irssi? - irc

I'm searching for a method to write a text with different colors like I always saw on other IRC channels. I want to achieve this with Irssi which is CLI based. I have found multiple methods which didn't work as expected. How can I for example write
WHAT
with green color for example?
I would like to achieve the same effect from a simple Bash script too.

First, make sure to enable text colors with
/set hide_colors OFF
Within Irssi, to answer your concrete question, type
Ctrl+C 3 WHAT
and then Enter. The text will show up in green. This convention is known as mIRC colour codes. To make it more comfortable, download the colour_popup script, place it in your ~/.irssi/scripts/autorun folder and run this command:
/statusbar prompt add -after input -alignment right colours
Then it will show you the available colours once you type Ctrl + C.
On the other hand with Bash, you need to use ANSI colour codes. To output green text, try this command:
printf "\e[%dm%s\e[m\n" 32 hallo
\e[ is a CSI (terminal control sequence start) and m is the command; it means character graphics attributes like colour, bold, ...
3 refers to the dull foreground colour table, 2 is green; valid colours go from 0-7. Bright colours are 90-97; background colours are 40-47 and 100-107. There are even more colours possible with other encodings, such as 256 colour table "38;5;<idx>" where <idx> is from 0-255, or 24 bit RGB colours "38;2;12;34;56" (12/255 red, 34/255 green, 56/255 blue); this is not supported by all terminals.

Related

checking how long are comments in a file

I just finished an assingment and according to the instructions I can't have a line of code or comment longer than 120 chars. is there a quick way to check that?
I'm using VSCODE on windows 10. I saw somewhere that I can make a verticle line in the editor to see if a row is too long but I can't find it now.
for example :
// return stack->size since stack->size holds the number of values that can be stored inside the array at a given time.
this comment is 119 chars so it is ok but anything bigger will cause me to lose points.
I know I can hold the last char in the sentence and see the 'col' number in VSCODE, I was hoping for something better.
thanks
"editor.rulers": [120]
Look at the Editor: Rulers setting:
Render vertical rulers after a certain number of monospace characters.
Use multiple values for multiple rulers. No rulers are drawn if array
is empty.
You can change its color or opacity like so (in your settings.json):
"workbench.colorCustomizations": {
"editorRuler.foreground": "#ff0000ff",
}
That changes the color to red, the last two hex digits are opacity. ff is 100% opaque. So you could try more transparent with #ff000080 for example. Color and transparency are the only two modifications you can make to rulers.

How to lighten up colors of syntax highlighting?

I need to make syntax colors lighter (for dark themes). Globaly or not.
Yes, in fact there is a dimmer switch that affects all faces. There are in fact several such dimmer switches: (1) to dim/brighten, (2) to heighten colors or make them more washed-out, (3) to move toward or away from a particular hue, or (4, 5, 6) to make them all more - or less - red, blue, or green.
All of these dimmer switches that act on all faces together are rolled into a single command -- well two commands: one for the face backgrounds (doremi-all-faces-bg+) and one for the face foregrounds (doremi-all-faces-fg+).
These are two of several Do Re Mi color incrementer commands. The others work on individual faces or on frame backgrounds and foregrounds. All of these commands work the same way. After invoking the command (e.g. M-x doremi-all-faces-bg+):
You are prompted for the color COMPONENT to increment/decrement (a character):
`r` - red
`g` - green
`b` - blue
`h` - hue (basic color)
`s` - saturation (purity)
`v` - value (brightness)
`R` - red, green, and blue, at the same time
`H` - hue, saturation, and value, at the same time
`R` and `H` increment all components of the respective color spaces,
according to the value of INCREMENT.
You can at any time change, to increment/decrement a different color
component (r, g, b, h, s, v, R, or H). For example, you can type `r`
and use the arrow keys or mouse wheel to change the red component,
then type `b` and use the arrows or wheel to change the blue
component, and so on, all in the same call.
For desaturating, that is, to render all colors more pale or washed-out, you just use s.
See Angry Fruit Salad for more information about this synchronized saturation dimming of all faces.
You can use the dimmer switch whenever you want, if you want more or less washed out colors. Or you can use it to find a good combination and then save the current face values in your custom-file (or your init file, if you do not have a custom-file, which you should have).
More likely, you will want to experiment by "dimming" and then follow that up with some customization of a few individual faces. For that, you can use the similar dimmer switches for individual faces (doremi-face-bg+ etc.). Incrementing qualities of all faces at once is a bit rough-and-ready. But for something like desaturating, it is very quick and does the job well.
Note that the face changes made using Do Re Mi commands are not saved automatically. User option doremi-customization-status controls how Customize views such changes.
By default, Customize sees them as if you had made them using the Customize UI. In this case, you can use command customize-unsaved to open Customize for them all, where you can save individual changes or all of the together.
If you set option doremi-customization-status to value outside then Customize sees the changes instead as having been made outside Customize. In this case, you can use command customize-rogue to open Customize for them all.
If you set the option to anything else then Customize ignores the changes altogether - you cannot use Customize to save them until you reapply them using Customize itself or a command such as set-face-foreground. This option setting can be useful if you just want to experiment and do not want Customize to see what you do.

Trying to figure out how to force Aquamacs (or any windowed Emacs) to use the xterm 256-colors

This question is in regards to forcing emacs to use a 256 color xterm color scheme.
When you open emacs in a terminal that supports xterm-256, it defaults to the xterm-256 color scheme, where default emacs font face colors like 'Firebrick' turns into something the xterm color scheme can display, which in this case is 'Red', so on and so forth. I really like this. I do not like the default emacs colors in a non-terminal setting; I think they are too faded and washed out-- I much prefer the brightness of the terminal colors.
(In fact I find myself programming in the terminal most often simply because I vastly prefer the typeface and the colors-- but I'd like to start using Aquamacs more for various reasons.)
For the life of me, I cannot figure out how to force Emacs (or in my case, Aquamacs) to force itself to downgrade the default color scheme to the xterm 256 color scheme like it does in my terminal. There has to be an easier way than making a new, ridiculously detailed color theme, but beyond the "TERM= " command you can set in your bashrc file (which obviously Aquamacs doesn't care about or use) I can't find anything equivalent in Emacs/Aquamacs that tells it to adopt a 256 color range so that it does things like turns Firebrick into the closest 'available' color, in this case, red.
I've attached screenshots. The first is how I want it to look like. (jpeg ruins the cripsness/brightness of the colors, but you get the idea.)
Second shot here is the default 'washed out' colors in aquamacs. See how the comments are in Firebrick (correctly displayed), versus the bright red of the comments in the above pic.
Variable names show up as more yellow in the top pic, but as more 'brown' in the bottom. Strings in the above file show up as more 'light brown' whereas in the bottom, it's more a dark brown. You can see they are definitely the same color scheme-- it's just that the terminal doesn't know about some of the colors and so it converts them to their baser, brighter forms.
Anybody know how to force this in Aquamacs? I've spent far too many hours researching this. :-)
Thanks!
Nick

How to darken postscript text produced by emacs

I'm using emacs command ps-spool-buffer-with-faces command to make some postscript files of code I'm working on. The problem is that the font color seems to be light gray instead of black. I've poked around the postscript file & googled a bit, but have not found any solution. Does anyone know how to turn my gray font black?
Assuming you just want to print in black and white, try:
(setq ps-print-color-p nil)
Otherwise, you might take a look at other values for ps-print-color-p:
ps-print-color-p is a variable defined in `ps-print.el'.
Its value is t
Documentation:
Specify how buffer's text color is printed.
Valid values are:
nil Do not print colors.
t Print colors.
black-white Print colors on black/white printer.
See also `ps-black-white-faces'.
Any other value is treated as t.
You can customize this variable.
You can customize using M-xcustomize-variableRETps-print-color-pRET

How to change the background color for the line number column in eclipse?

I am using Eclipse 3.6.1 classic and trying to tweak the color syntax to my desire. The one thing I haven't been able to change is the background color for the line number column. If this is not possible because Eclipse doesn't have an option for it, I will be satisfied even with a hack/plugin if any of you know of any.
Thanks.
There is not an explicit setting for changing the background color of the line number column (Eclipse Helios, SR2, Build id: 20110218-0911). However, there are work-arounds and here is one:
The line number background changes color according to any changes you make in the Text Editors "Background color" - so the two are the same. Between these two is the column holding the debugging breakpoints (not sure what that column is called) and it's background color is not affected when changing the general background.
I run Eclipse on Linux (Oracle's version) and access it with XMing X-server from a PC. Setting this background color to a very pale yellow makes the narrow column holding the debugging breakpoints standout - and that column is between the text and the line number column. So the effect is to make the boundaries of the line number column more clear.
The very pale yellow is #FCFFC8 = RGB 252,255,200 = HSV 63,22,100
Eclipse often behaves a little differently when I run it straight from my PC so this behavior may be one of those cases.
Hope this helps.
Go to Preferences -> General -> Editors -> Text Editors -> Appearance color options and you will see that you can set the color of the line numbers using Line number foreground option and you can set the background of the line numbers column using Background color option.