Skip to content

Commit 8636e7a

Browse files
kmcnaughtJuliusSweetland
authored andcommitted
Fix styling of keyboard error screen
Sometimes the styles were not active at the right time for us to swap the enabled/disabled colours. Instead we choose "black on white" for all keyboard error screens, regardless of theme.
1 parent f5f8996 commit 8636e7a

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/JuliusSweetland.OptiKey.Core/UI/Views/Keyboards/Common/DynamicKeyboard.xaml.cs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,25 @@ private void SetupErrorLayout(string heading, string content)
318318
AddRowsToGrid(4);
319319
AddColsToGrid(4);
320320

321-
// Top middle two cells are main error message
321+
// We hardcode black-on-white text for full visibility
322+
323+
// Top middle two cells are main error message
322324
{
323325
var newKey = new Key {
324326
Text = heading,
327+
DisabledForegroundColourOverride = Brushes.Black,
328+
DisabledBackgroundColourOverride = Brushes.White
325329
};
326-
// Swap for default "not disabled" foreground colour for better visibility
327-
newKey.DisabledForegroundColourOverride = newKey.Foreground;
328330

329331
PlaceKeyInPosition(newKey, 0, 1, 1, 2);
330332
}
331333
// Middle row is detailed error message
332334
{
333335
var newKey = new Key {
334336
Text = content,
337+
DisabledForegroundColourOverride = Brushes.Black,
338+
DisabledBackgroundColourOverride = Brushes.White
335339
};
336-
// Swap for default "not disabled" foreground colour for better visibility
337-
newKey.DisabledForegroundColourOverride = newKey.Foreground;
338340

339341
PlaceKeyInPosition(newKey, 1, 0, 2, 4);
340342
}
@@ -345,26 +347,40 @@ private void SetupErrorLayout(string heading, string content)
345347
{
346348
SymbolGeometry = (Geometry)Application.Current.Resources["BackIcon"],
347349
Text = Properties.Resources.BACK,
348-
Value = KeyValues.BackFromKeyboardKey
350+
Value = KeyValues.BackFromKeyboardKey,
351+
ForegroundColourOverride = Brushes.Black,
352+
BackgroundColourOverride = Brushes.White
349353
};
350354
PlaceKeyInPosition(newKey, 3, 3);
351355
}
352356

353357
// Fill in empty keys
354358
{
355-
var newKey = new Key();
359+
var newKey = new Key {
360+
DisabledForegroundColourOverride = Brushes.Black,
361+
DisabledBackgroundColourOverride = Brushes.White
362+
};
356363
PlaceKeyInPosition(newKey, 0, 0, 1, 1);
357364
}
358365
{
359-
var newKey = new Key();
366+
var newKey = new Key {
367+
DisabledForegroundColourOverride = Brushes.Black,
368+
DisabledBackgroundColourOverride = Brushes.White
369+
};
360370
PlaceKeyInPosition(newKey, 0, 3, 1, 1);
361371
}
362372
{
363-
var newKey = new Key();
373+
var newKey = new Key {
374+
DisabledForegroundColourOverride = Brushes.Black,
375+
DisabledBackgroundColourOverride = Brushes.White
376+
};
364377
PlaceKeyInPosition(newKey, 3, 0, 1, 1);
365378
}
366379
{
367-
var newKey = new Key();
380+
var newKey = new Key {
381+
DisabledForegroundColourOverride = Brushes.Black,
382+
DisabledBackgroundColourOverride = Brushes.White
383+
};
368384
PlaceKeyInPosition(newKey, 3, 1, 1, 2);
369385
}
370386

0 commit comments

Comments
 (0)