Skip to content

Commit ce6da51

Browse files
committed
Update to use theme text colour for caretForeground
1 parent d9537b5 commit ce6da51

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/main/java/mdlaf/MaterialLookAndFeel.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ protected void initComponentDefaults(UIDefaults table) {
469469
table.put("TextArea.selectionForeground", theme.getSelectionForegroundTextField());
470470
table.put("TextArea.foreground", theme.getTextColor());
471471
table.put("TextArea.font", theme.getFontBold());
472+
table.put("TextArea.caretForeground", theme.getTextColor());
473+
474+
table.put("TextPane.caretForeground", theme.getTextColor());
472475

473476
table.put("ToggleButton.border", BorderFactory.createEmptyBorder());
474477
table.put("ToggleButton.font", theme.getFontRegular());
@@ -536,6 +539,7 @@ protected void initComponentDefaults(UIDefaults table) {
536539
table.put("EditorPane.selectionBackground", theme.getSelectionBackgroundTextField());
537540
table.put("EditorPane.inactiveForeground", theme.getSelectionForegroundTextField());
538541
table.put("EditorPane.font", theme.getFontRegular());
542+
table.put("EditorPane.caretForeground", theme.getTextColor());
539543
table.put("EditorPane.focusInputMap", multilineInputMap);
540544

541545
table.put("Separator.background", theme.getBackgroundSeparator());
@@ -558,7 +562,8 @@ protected void initComponentDefaults(UIDefaults table) {
558562
table.put("TextField[Line].activeColor", theme.getActiveColorLineTextField());
559563
table.put("TextField.border", theme.getBorderTextField());
560564
table.put("TextField.focusInputMap", fieldInputMap);
561-
565+
table.put("TextField.caretForeground", theme.getTextColor());
566+
562567
table.put("PasswordField.background", theme.getBackgroundTextField());
563568
table.put("PasswordField.foreground", theme.getTextColor());
564569
table.put("PasswordField.disabledBackground", theme.getDisabledBackgroudnTextField());
@@ -572,7 +577,8 @@ protected void initComponentDefaults(UIDefaults table) {
572577
table.put("PasswordField.border", theme.getBorderTextField());
573578
table.put("PasswordField.echoChar", theme.getEchoCharPasswordField());
574579
table.put("PasswordField.focusInputMap", fieldInputMap);
575-
580+
table.put("PasswordField.caretForeground", theme.getTextColor());
581+
576582
table.put("TitledBorder.border", theme.getBorderTitledBorder());
577583
table.put("TitledBorder.font", theme.getFontMedium());
578584
table.put("TitledBorder.titleColor", theme.getColorTextTitledBorder());
@@ -597,6 +603,7 @@ protected void initComponentDefaults(UIDefaults table) {
597603
table.put("FormattedTextField.selectionBackground", theme.getSelectionBackgroundTextField());
598604
table.put("FormattedTextField.selectionForeground", theme.getSelectionForegroundTextField());
599605
table.put("FormattedTextField.border", theme.getBorderTextField());
606+
table.put("FormattedTextField.caretForeground", theme.getTextColor());
600607

601608
table.put("List.background", theme.getBackgroundPrimary());
602609
table.put("List.foreground", theme.getTextColor());

src/main/java/mdlaf/themes/MaterialOceanicTheme.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ protected void installColor() {
239239
@Override
240240
public void installUIDefault(UIDefaults table) {
241241
super.installUIDefault(table);
242-
243-
table.put("TextField.caretForeground", Color.WHITE);
244-
table.put("TextArea.caretForeground", Color.WHITE);
245-
table.put("TextPane.caretForeground", Color.WHITE);
246-
table.put("PasswordField.caretForeground", Color.WHITE);
247242
}
248243

249244
@Override

0 commit comments

Comments
 (0)