...making Linux just a little more fun! |
By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You! |
We have guidelines for asking and answering questions. Linux questions only, please.
We make no guarantees about answers, but you can be anonymous on request.
See also: The Answer Gang's
Knowledge Base
and the LG
Search Engine
From frank.n. dale
Answered By: Thomas Adam
Hello Gang,
Assume X is not running and your framebuffer allows for 256 colors or more.
Please give manual instructions (or C code) to write on the screen 64 characters in different colors.
[Thomas] Hi, there. Assume for a moment that we cared. Then realise that actually this is The Answer Gang to do with Linux questions. Then assume that we do not answer homework questions. Then assume that you want to look here:
https://linuxgazette.net/tag/ask-the-gang.html
If you assume all of these, then you have a tautology.
Of course your programming homework is quite easy to do, it just requires that you do a little research first, as with any academic course you might be studying. It takes work, and if you are not prepared to put any in, why bother with it? If you do not understand it, then that is a different matter, to be taken up with your lecturer.
Please do not forward this query to Thomas Adam, he does not know.
[Thomas] Unfortunately, I do.
How do you set and get colors outside the range 0-F hex when using framebuffer in the Linux console?
[Thomas] For this, you will have to look at vga.c in the kernel source, and at fb.c. You will almost certainly have to hack the kernel source to allow this.
This query is not a home work exercise. It is based on fruitless Goggle search of many hours over a span of several months. The major framebuffer sites
https://linuxconsole.sourceforge.net/fbdev https://linux-fbdev.sourceforge.net https://www.directfb.org
do not deal with it nor does the HOWTO-framebuffer. Also the console escape sequences for colors only apply to colors 0-F.
The only solution found so far involves the SVGALib which is too much of an overhead. There must be a simpler solution. Do you know more than I do?
[Thomas] SVGALib is nothing to do with framebuffers, but it will allow you to display console screen resolutions higher than the default.
[Heather] Other than the vague bit about it being able to use FBDev as its video type, if you have a framebuffer enabled kernel and your monitor settings are right in /etc/libvga.config.
The query is relevant for syntax coloring in the Linux console (text, no X). With the standard 16 foreground and 8 background colors, syntax coloring is a pain in the eyes. With the 256 colors or more that you get from framebuffer, syntax coloring could become pleasant and effective.
[Thomas] So why not run your console with a setting of:
vga=0x317
while will run a 1024x786x256 colours.
Look here:
Colours 640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200 --------+-------------------------------------------------------------- 4 bits | ? ? 0x302 ? ? ? ? 8 bits | 0x300 0x301 0x303 0x305 0x161 0x307 0x31C 15 bits | ? 0x310 0x313 0x316 0x162 0x319 0x31D 16 bits | ? 0x311 0x314 0x317 0x163 0x31A 0x31E 24 bits | ? 0x312 0x315 0x318 ? 0x31B 0x31F 32 bits | ? ? ? ? 0x164 ?
(this is for: vga=<foo> in /etc/lilo.conf).
Meet the Gang 1 2 3 4 5 6 7 |