From: cga2000 <cg...@op...> - 2007-10-23 03:12:50
|
On Mon, Oct 22, 2007 at 10:20:35AM EDT, Antonino A. Daplas wrote: > On Sun, 2007-10-21 at 20:30 -0400, cga2000 wrote: > > On Sun, Oct 21, 2007 at 07:31:31PM EDT, Antonino A. Daplas wrote: > > > On Sun, 2007-10-21 at 08:34 -0400, cga2000 wrote: > > > > > On Sat, Oct 20, 2007 at 12:06:31PM EDT, Antonino A. Daplas wrote: > > > > > > > > The 16 entries is standard since the linux console is limited to > > > 16 colors. As to why separate each component (R, G, B) into 3 > > > files, it's because that is the simplest way, otherwise, we have > > > to add additional code to separate each color into its components > > > before feeding them to the console layer. > > OK. > > > > So we have three files for our three fundamental colors. > > You have probably realized I'm a bit thick by now .. but why 16 > > entries to each file - iow, I would have expected one for the > > background, one for the foreground .. etc. > > I'm still a bit lost. > > Do you mean why not one file per attribute? ... ie, > default_foreground, default_background, default_underline, etc? It is > simply more complicated since we have to take into consideration how a > console driver represents an attribute, ie, one driver may use blue > for underline, another may use green, and in another ignored. > Color though is treated the same whatever driver you use. OK .. I think I get it. 3 files x 16 entries define a 16-color palette with the three rgb channels in separate files. So that if the first entry is 0 in all three files, color0 will be [rgb:0,0,0] (black) .. if it is 127 in all three files it will be [rgb:127,127,127] (grey50..?) etc. If the second entry is 255 in the default_red file and 0 in both default_green and default_blue .. color1 will be pure red .. And naturally if I want color15 to be pure white the last entry in all three files needs to be set to 255. Right? In other words the three files represent the three rgb channels and the 16 entries the different red, green, blue values for each of the 16 colors the console is capable of displaying simultaneously. But then why does the bash shell display my input commands in light grey rather than white? Does this mean that I have 8 x 2 colors and that some kind of a bold attribute being on of off as the application decides .. causes only text that is highlighted to be displayed in white while "normal" text is displayed in grey? I don't suppose anyone has come up with a little utility that loops on the 3x16 entries and issues escape sequences to display a semi-graphical representation of the current color palette? Something that would display 8x2 squares visualizing the 16 colors. This would make it a lot easier to tell at a glance what the current palette looks like .. although I'm sure that with a bit of practice I will be able to see it just by glancing at the default_{red|grn|blu} files. :-) Thanks, cga |