change palete for -Frame border color- #211
Replies: 1 comment
-
|
Hola, @jordiperezartigues! Similarly to what I wrote in #209: // Palette indexes as documented in the header files.
const int appGrayWindowPaletteIndex = 24;
const int windowFrameActivePaletteIndex = 2;
const int appGrayDialogPaletteIndex = 32;
const int dialogFrameActivePaletteIndex = 2;
TPalette& TMyApp::getPalette() const
{
static char cp[] = cpAppColor;
// Use black-on-gray (instead of white-on-gray) for frames in gray windows and dialogs.
cp[appGrayWindowPaletteIndex-1 + windowFrameActivePaletteIndex-1] = '\x70'; // 7 for gray, 0 for black
cp[appGrayDialogPaletteIndex-1 + dialogFrameActivePaletteIndex-1] = '\x70';
static TPalette palette(cp, sizeof(cp));
return palette;
}Feel free to use any other color you would like: BIOS color attributes. I took the palette indices from these places: Lines 232 to 240 in 85aaeca tvision/include/tvision/views.h Lines 980 to 984 in 85aaeca tvision/include/tvision/dialogs.h Lines 40 to 44 in 85aaeca An alternative solution could be to force specific RGB colors for every single palette entry so that the application always looks the same regardless of the terminal emulator's color scheme. Similarly to what I wrote in magiblot/turbo#94 (comment): #include <array>
constexpr TColorRGB biosToRgb(char bios)
{
switch (bios & 0xF)
{
// Use the default VGA colors.
case 0: return 0x000000;
case 1: return 0x0000C4;
case 2: return 0x00C400;
case 3: return 0x00C4C4;
case 4: return 0xC40000;
case 5: return 0xC400C4;
case 6: return 0xC47E00;
case 7: return 0xC4C4C4;
case 8: return 0x4E4E4E;
case 9: return 0x4E4EDC;
case 10: return 0x4EDC4E;
case 11: return 0x4EF3F3;
case 12: return 0xDC4E4E;
case 13: return 0xF34EF3;
case 14: return 0xF3F34E;
default: return 0xFFFFFF;
}
}
constexpr std::array<TColorAttr, 135> convertBiosPaletteToRgb(const char *biosPalette)
{
std::array<TColorAttr, 135> rgbPalette = {};
for (size_t i = 0; i < 135; ++i)
rgbPalette[i] = {
biosToRgb(biosPalette[i]),
biosToRgb(biosPalette[i] >> 4),
};
return rgbPalette;
}
TPalette& TMyApp::getPalette() const
{
static constexpr std::array<TColorAttr, 135> cpAppRgbColor =
convertBiosPaletteToRgb(cpAppColor);
static TPalette palette(cpAppRgbColor.data(), cpAppRgbColor.size());
return palette;
}Cheers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to change the Frame border color to black, is white and fades with the lightgrey dialog and frame background.
Shall be something like getPalete by some index and set the black color. can someone point how to do this?
Beta Was this translation helpful? Give feedback.
All reactions