Setup menu color customization - #263
Conversation
|
I just wondered recently when someone will dare to touch CustomizedDisplayLib and play with it :) We would have to somehow match the Dasharo green colour (on dasharo.com page the hex color for green is If I color pick the green from the picture you posted, it gives me |
CustomizedDisplayLib only supports a small color palette which looks similar to VGA color palette. There are a total of 8 possible background colors and 16 text colors, so sadly there is little possibilities to play with. There are only two green shades possible for text - green and light green, for backgrounds its only the green you see. I can't tell if it would be feasible to extend the color palette. It might be more challenging than just exposing the colors as PSDs. |
|
I think it will be inevitable to change Also we have to take care of serial terminal colors in Also you may try to change the font to something more close to what we use on dasharo.com (I believe it is oswald font regular-400 or a Font Awesome 6 regular-400) |
|
Colors taken from dasharo.com that I suggest that may be suitable: DARKGRAY - |
Of course it doesn't :) Check out this: https://gist.github.com/viniciusdaniel/53a98cbb1d8cac1bb473da23f5708836 |
|
Couple more suggestions to the color selection:
|
That might be more troublesome than expected 😆 Adding a support for vector fonts might be a little too much for now, but maybe it could be feasible to create a tool that could convert vector fonts into bitmaps like the one defined in |
|
I've been fiddling around with converting the Oswald font to bitmaps. The results seemed promising, but in the end I think it will not be possible to properly display a proper vector font in 19x8 resolution. That's the best results I was able to achieve. While it's possible to do some postprocessing to fix jagged edges, losing detail is inevitable. Creating such a small font requires working with pixel art.
The scripts for the conversion are on a separate branch as I will scrap that idea for now. |
|
Yeah the font does not look great and would require more work. The colors look interesting, though. |
cb616c6 to
145ff2b
Compare
4483433 to
2473d00
Compare
Should be easy with
Yeah, the letters in the top section are far from being white... But hey, it looks neat already. |
|
It looks like whatever exact code prints the graphical version of setup menu correctly uses the code |
The issue was the line With that out of the way I think all issues with this PR are fixed? |
899a8df to
e86d004
Compare
|
Looks cool. I will not judge the implementation, but definitely having our theme is a nice direction. It gives us some branding alignment. |
| return; | ||
| } | ||
|
|
||
| gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND); |
There was a problem hiding this comment.
I wonder if it would not be easier to replace definitions of these macros in MdeModulePkg/Library/CustomizedDisplayLib/Colors.h: like this:
-#define KEYHELP_TEXT EFI_LIGHTGRAY
-#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
+#define KEYHELP_TEXT PcdGet8 (PcdBrowserKeyHelpTextColor)
+#define KEYHELP_BACKGROUND PcdGet8 (PcdBrowserKeyHelpBackgroundColor)Then we could remove all those Get*Color helpers
There was a problem hiding this comment.
@philipanda do you plan to change it per suggestion?
There was a problem hiding this comment.
Sorry, I didn't have much time to work on the PR lately.
Your suggestion makes sense, I do plan to change that
There was a problem hiding this comment.
I saw that you rebased it, so I assumed you have found some time :)
There was a problem hiding this comment.
After looking into it deeper I start to doubt removing the helpers and using the defines instead will make it simpler or cleaner.
There were already a couple of such helpers available because some color mixes were used multiple times across the code, example GetFieldTextColor.
I think the cleanest solution would be to make a macro like:
#define GetTextColor(type) (type##Text | type##Background)and go with defining every foreground/background combination in the Pcds and remove all the helpers.
Otherwise it will stay a mess with multiple ways of accessing them, because some places would use (define_f | define_b) and others would call the helpers.
If so then all the usages would need to be updated too.
I think it would be a good change, but I'm not sure such a cleanup should be bundled along this PR?
There was a problem hiding this comment.
9f4ccf6 applies that to only the helpers that were added in this PR before.
Added missing ErrorText color PCD too

There was a problem hiding this comment.
I think it would be a good change, but I'm not sure such a cleanup should be bundled along this PR?
Well, you are redesigning the whole color styles. If not here, then where? Can you assure that nothing will break if you skip it in this PR?
There was a problem hiding this comment.
I am confident nothing will break if I don't touch these public functions. I won't be so sure nothing breaks in other modules if I do. If some automatic validation would be enough to ensure it, that would be good. I'm just a bit worried about the size and duration of this PR. If it's preferred to deliver full feature-complete changes, then I guess it cannot be helped :)
Pop-ups are created in two ways:
So we would only have to handle case 1. So far, I have seen |
If |
We already have the PCDs: I think the best we can do is to replace all |
Right, I thought they were used for some other popups I've never seen before looking that the colors are not |
c426ae7 to
73f2613
Compare
Signed-off-by: Filip Go¿a¿ <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Go¿a¿ <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
Signed-off-by: Filip Gołaś <philipgoclever@gmail.com>
… later Signed-off-by: Filip Gołaś <philipgoclever@gmail.com>
166e673 to
9f4ccf6
Compare
Hmm, there's an intention problem in this case. The popup creator most of the times does not care about the color, but when they do, they want to choose it specifically (like in capsules V2, green for a success, red for a failure). Ideally the creator of a custom-color popup would also provide some PCDs in MdeModulePkg to configure it's color or use existing ones. |
And that would still work as expected:
I have the same intention of preserving the behaviors.
There is no need for that |
|
|
||
| TerminalEfiColor mTerminalEfiColors[16]; | ||
|
|
||
| VOID CopyTerminalPaletteColor(IN UINT8* Src, OUT TerminalEfiColor* Dest) { |
There was a problem hiding this comment.
Usual order of parameters for copy methods is Copy(Dest, Src)
Won't the "meaning" of colors be overridden here in GraphicsConsole: https://github.com/Dasharo/edk2/pull/263/changes#diff-da573dc5f5ed707edfc467f207afb3e8098a02471e651d52de8fa06e0dca3648R92-R107 ? So choosing |
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlack | { 0x00, 0x00, 0x00, 0x00 } | VOID* | 0x00010400 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlue | { 0x00, 0x00, 0x00, 0x98 } | VOID* | 0x00010401 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteGreen | { 0x00, 0x00, 0x98, 0x00 } | VOID* | 0x00010402 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteCyan | { 0x00, 0x00, 0x98, 0x98 } | VOID* | 0x00010403 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteRed | { 0x00, 0x98, 0x00, 0x00 } | VOID* | 0x00010404 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightMagenta | { 0x00, 0x98, 0x00, 0x98 } | VOID* | 0x00010405 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBrown | { 0x00, 0x98, 0x98, 0x00 } | VOID* | 0x00010406 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGray | { 0x00, 0x98, 0x98, 0x98 } | VOID* | 0x00010407 | ||
|
|
||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteDarkGray | { 0x00, 0x30, 0x30, 0x30 } | VOID* | 0x00010408 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightBlue | { 0x00, 0x00, 0x00, 0xFF } | VOID* | 0x00010409 | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGreen | { 0x00, 0x00, 0xFF, 0x00 } | VOID* | 0x0001040A | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightCyan | { 0x00, 0xFF, 0xFF, 0x00 } | VOID* | 0x0001040B | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed | { 0x00, 0xFF, 0x00, 0x00 } | VOID* | 0x0001040C | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta | { 0x00, 0xFF, 0x00, 0xFF } | VOID* | 0x0001040D | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteYellow | { 0x00, 0xFF, 0xFF, 0x00 } | VOID* | 0x0001040E | ||
| gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteWhite | { 0x00, 0xFF, 0xFF, 0xFF } | VOID* | 0x0001040F |
There was a problem hiding this comment.
Please remove the redundant spaces. They are not even aligned properly for readability
There was a problem hiding this comment.
I thought they helped with readibility by splitting it into two blocks of 8 each.
Can remove, sure
There was a problem hiding this comment.
I meant the spaces near the pipes |, e.g.
gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed | { 0x00, 0xFF, 0x00, 0x00 } | VOID* | 0x0001040C
gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta | { 0x00, 0xFF, 0x00, 0xFF } | VOID* | 0x0001040D
See? Eveywhere else in the repo there is no space around pipe character |, so I would do the same here.
There was a problem hiding this comment.
right, I see now 👍
Right, the meaning of colors has changed because of Still, my suggestion remains the same with Also, we may only override the pallete once we enter setup (exception, red pop-ups insetup). If we leave the setup, we may bring back the default one. |
Hmm, interesing, if we're going that far, then why not support multiple palletes everywhere and switch them dynamically? On the other hand, I think it would be cleanest to stop treating colors like RGB, and instead choose them semantically. Like in Colors.h, e.g. ERROR_TEXT. It would change the approach, but allow full theming. The author of a theme could decide what color they want to mean a warning, what color would mean a success etc. E.g. in capsule updates results screen, an Error color would be used instead of Red for a failure, and a Success color would be used instead of Green. I guess a way of overriding this and loading the default theme could be needed still. But if we're doing such an overhaul, why not just apply themes to everything in EDK2? |
Note that we are still limited by the UEFI specification which clearly states 4bits for FG color and 4 bits for BG color: https://uefi.org/specs/UEFI/2.11/12_Protocols_Console_Support.html#efi-simple-text-output-protocol-setattribute
Do we really need that many? I think we initially wanted to customize the setup and that's enough. Everything else may stay as it was.
Can you elaborate? |
I mean overriding the custom theme and going back to the default colors everyone expects might be needed just in case some screen / efi app would not want to be affected by the custom themes. It might be or not be needed. I'd say it's not needed, but might be nice to keep such posibility in mind? By overhaul I mean making every call of CreatePopUp use the -1 special value instead of I can't think of a serious reason why someone would really want to have a specific color that's unaffected by the themes. I think the colors used are supposed to carry some meaning related to it, not the color RGB values. |
|
Graphical setup UI in upstream coreboot: |








Description
Extracting hardcoded colors from setup menu into PCDs allowing for easy customisation.
Added a Dasharo theme as a bonus and PoC.
How This Was Tested
qemu-system-x86_64 -machine q35 -serial telnet:localhost:1345,server,nowait -drive if=pflash,format=raw,unit=0,file=build/coreboot.rom
Integration Instructions