+
+ /* Override with system colours if appropriate */
+ if (cfg.system_colour)
+ systopalette();
+}
+
+/*
+ * Override bit of defpal with colours from the system.
+ * (NB that this takes a copy the system colours at the time this is called,
+ * so subsequent colour scheme changes don't take effect. To fix that we'd
+ * probably want to be using GetSysColorBrush() and the like.)
+ */
+static void systopalette(void)
+{
+ int i;
+ static const struct { int nIndex; int norm; int bold; } or[] =
+ {
+ { COLOR_WINDOWTEXT, 16, 17 }, /* Default Foreground */
+ { COLOR_WINDOW, 18, 19 }, /* Default Background */
+ { COLOR_HIGHLIGHTTEXT, 20, 21 }, /* Cursor Text */
+ { COLOR_HIGHLIGHT, 22, 23 }, /* Cursor Colour */
+ };
+
+ for (i = 0; i < (sizeof(or)/sizeof(or[0])); i++) {
+ COLORREF colour = GetSysColor(or[i].nIndex);
+ defpal[or[i].norm].rgbtRed =
+ defpal[or[i].bold].rgbtRed = GetRValue(colour);
+ defpal[or[i].norm].rgbtGreen =
+ defpal[or[i].bold].rgbtGreen = GetGValue(colour);
+ defpal[or[i].norm].rgbtBlue =
+ defpal[or[i].bold].rgbtBlue = GetBValue(colour);
+ }