Add support for bg color of readonly text input

This commit is contained in:
mkpaz 2023-05-17 15:37:23 +04:00
parent 19d7f4fee7
commit 70043895b0
5 changed files with 30 additions and 0 deletions

@ -43,6 +43,7 @@ public class DatePickerPage extends OutlinePage {
var today = LocalDate.now(ZoneId.systemDefault()); var today = LocalDate.now(ZoneId.systemDefault());
var dp1 = new DatePicker(today); var dp1 = new DatePicker(today);
dp1.setEditable(false);
dp1.setPrefWidth(200); dp1.setPrefWidth(200);
var dp2 = new DatePicker(today.plusDays(10)); var dp2 = new DatePicker(today.plusDays(10));

@ -16,6 +16,7 @@
-color-input-bg: transparent; -color-input-bg: transparent;
-color-input-fg: -color-contrast-checker-fg; -color-input-fg: -color-contrast-checker-fg;
-color-input-border: transparent; -color-input-border: transparent;
-color-input-bg-readonly: transparent;
-color-input-bg-focused: transparent; -color-input-bg-focused: transparent;
-color-input-border-focused: transparent; -color-input-border-focused: transparent;

@ -69,6 +69,16 @@ $chrono-cell-padding: 0.083333em $cell-padding-x 0.083333em 0.333333em !default;
-fx-padding: 0.416667em; // icon size -fx-padding: 0.416667em; // icon size
} }
} }
>.text-field {
&:readonly {
-fx-background-color: -color-input-border, -color-input-bg;
}
&:readonly:focused {
-fx-background-color: -color-input-border-focused, -color-input-bg-focused;
}
}
} }
.combo-box-popup>.date-picker-popup { .combo-box-popup>.date-picker-popup {

@ -22,6 +22,14 @@ $icon-padding-x: 0.25em !default;
calc(cfg.$padding-x - cfg.$border-width) calc(cfg.$padding-x - cfg.$border-width)
calc(cfg.$padding-y - cfg.$border-width) calc(cfg.$padding-y - cfg.$border-width)
calc(cfg.$padding-x - cfg.$border-width); calc(cfg.$padding-x - cfg.$border-width);
&:readonly {
-fx-background-color: -color-input-border, -color-input-bg;
}
&:readonly:focused {
-fx-background-color: -color-input-border-focused, -color-input-bg-focused;
}
} }
>.increment-arrow-button { >.increment-arrow-button {

@ -9,6 +9,7 @@ $color-border: -color-border-default !default;
$color-bg-focused: -color-bg-default !default; $color-bg-focused: -color-bg-default !default;
$color-border-focused: -color-accent-emphasis !default; $color-border-focused: -color-accent-emphasis !default;
$color-bg-readonly: -color-bg-subtle !default;
$color-bg-highlight: -color-accent-subtle !default; $color-bg-highlight: -color-accent-subtle !default;
$color-fg-highlight: -color-fg-default !default; $color-fg-highlight: -color-fg-default !default;
@ -33,6 +34,7 @@ $color-fg-password: -color-fg-muted !default;
-color-input-bg-focused: $color-bg-focused; -color-input-bg-focused: $color-bg-focused;
-color-input-border-focused: $color-border-focused; -color-input-border-focused: $color-border-focused;
-color-input-bg-readonly: $color-bg-readonly;
-color-input-bg-highlight: $color-bg-highlight; -color-input-bg-highlight: $color-bg-highlight;
-color-input-fg-highlight: $color-fg-highlight; -color-input-fg-highlight: $color-fg-highlight;
@ -76,6 +78,14 @@ $color-fg-password: -color-fg-muted !default;
-color-input-border-focused: $color-border-danger; -color-input-border-focused: $color-border-danger;
} }
&:readonly {
-fx-background-color: -color-input-border, -color-input-bg-readonly;
}
&:readonly:focused {
-fx-background-color: -color-input-border-focused, -color-input-bg-readonly;
}
// input group // input group
&.left-pill { &.left-pill {
-fx-background-radius: cfg.$border-radius 0 0 cfg.$border-radius, cfg.$inner-border-radius 0 0 cfg.$inner-border-radius; -fx-background-radius: cfg.$border-radius 0 0 cfg.$border-radius, cfg.$inner-border-radius 0 0 cfg.$inner-border-radius;