Page MenuHomeFreeBSD

loader: support numeric and named bright colors (8-15)
ClosedPublic

Authored by emaste on Mar 9 2022, 9:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 6:42 AM
Unknown Object (File)
Mar 16 2024, 5:46 PM
Unknown Object (File)
Mar 16 2024, 5:46 PM
Unknown Object (File)
Mar 16 2024, 5:46 PM
Unknown Object (File)
Mar 16 2024, 5:46 PM
Unknown Object (File)
Mar 14 2024, 1:51 AM
Unknown Object (File)
Feb 21 2024, 5:43 PM
Unknown Object (File)
Feb 21 2024, 2:08 AM
Subscribers

Details

Summary

Accept "bright" or "light" prefix for colors 8-15. Update error message to specify that numeric colors 0 to 15 are allowed, and verify that specified color is between 0 and 15.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste requested review of this revision.Mar 9 2022, 9:18 PM

Hm, perhaps also look for "light" or "bright" in color_name_to_teken so that e.g. "brightred" can be used. Something like

 static bool
 color_name_to_teken(const char *name, int *val)
 {
+       int light = 0;
+       if (strcasecmp(name, "light") == 0) {
+               name += 5;
+               light = TC_LIGHT;
+       } else if (strcasecmp(name, "bright") == 0) {
+               name += 6;
+               light = TC_LIGHT;
+       }
        if (strcasecmp(name, "black") == 0) {
-               *val = TC_BLACK;
+               *val = light | TC_BLACK;
                return (true);
        }

We could then also remove the special case for white background:

/* Improve visibility */
if (a.ta_bgcolor == TC_WHITE)
        a.ta_bgcolor |= TC_LIGHT;

and just let the user specify 15 or brightwhite

This revision is now accepted and ready to land.Mar 9 2022, 9:34 PM
emaste retitled this revision from loader: allow teken colors between 0 and 15 to loader: support numeric and named bright colors (8-15).
emaste edited the summary of this revision. (Show Details)
  • allow "light" or "bright" prefix for colors 8-15 (e.g. brightred)
This revision now requires review to proceed.Mar 10 2022, 6:39 PM
This revision is now accepted and ready to land.Mar 11 2022, 11:24 AM

Seems reasonable to me, this highlights some unshared code that perhaps should be shared, though that's 'feedback' not 'you gotta make this change'

stand/efi/libefi/efi_console.c
438

It would be nice if this code could be shared.

stand/efi/libefi/efi_console.c
438

Indeed, it really should be. I expect to continue looking at this in the context of D34509 and will see about doing that as part of that effort.