Thread: [Linux] Limitations on patching /drivers/char/vt.c to support 256 colors

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446

    [Linux] Limitations on patching /drivers/char/vt.c to support 256 colors

    This has been nagging me since day 1 of using Linux. It was always a mystery to me why the tty device doesn't support 256 colors. Only recently, as I struggle to learn Linux, I started to go through framebuffers and terminal emulators and the works. Reading numerous threads on forums everywhere and trying to understand documentation didn't quite help me answer this question. Answers are usually derisive, or fleeting, and often indicating the person answering really doesn't know what they are talking about. The best I could ever get was that I would need to hack the kernel and do it myself. That's fair enough. But the question then becomes why haven't someone?

    I finally got a break when I started reading on the kernel and understood(?) where to look for stuff. And that's where I am now.

    ...

    I've been looking at drivers/char/vt.c like it was my wife for the past couple of days. But still can't quite understand it. The VT102 emulator it defines and that serves as the basis for the virtual terminal device puts no restrictions on color depth that I can see. Yet it defines only 16 colors through escape sequences.

    What's been stopping a patch to support 256 colors? Framebuffers can support higher color depths. At a very minimum, 8 bit. It's a shame the virtual terminal upstream limits their reach.

    The only thing I can think of is limitations on the very escape sequences. The current format doesn't abstract well a 256 color space. Especially because it's already partially used. I don't see how it could be extended into 256 colors and not be a mess. But couldn't a new one be devised with internal alias to the old one so it remained backwards compatible?
    Last edited by Mario F.; 08-01-2010 at 09:34 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    I think you pretty much nailed it.
    How to extend the ANSI escape sequences without creating a backward incompatible mess.

    Your particular hardware might be very capable, but the ANSI escape sequences cover a pretty wide range. The terminals for which it was originally designed didn't do colour (unless you counted green as a colour).

    Sooner or later, you stop finding hammers and chisels in stationery stores, because no-one (except for a few specialists) uses those things to write with anymore.

    It's obsolete tech designed for a bygone age. Nobody cares enough to bring it right up to date, because there is little or no interest.

    Why stop at 8-bit? No doubt others would complain about the lack of access to a full 32-bit gamut.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Thanks Salem. I think I finally understand the problem here.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LDAP Query
    By Travoiz in forum C++ Programming
    Replies: 0
    Last Post: 08-13-2009, 02:58 PM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 06:20 PM
  4. support 256 colors...
    By jackie_islam in forum C Programming
    Replies: 4
    Last Post: 03-12-2002, 01:29 PM