Skip to content

Commit d092f48

Browse files
authored
feat(form): apply state color also to label class
When the form with error state contain the labels, these labels will be styled as red color, but only they're used as HTML label element. Now, any element with label class will have the same style as label element, and produces more consistent design flow.
1 parent 8bbda5f commit d092f48

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/definitions/collections/form.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@
468468
@c: @formStates[@@state][color];
469469
@bg: @formStates[@@state][background];
470470
@bdc: @formStates[@@state][borderColor];
471+
@lbg: @formStates[@@state][labelBackground];
471472

472473
/* On Form */
473474
.ui.form.@{state} .@{state}.message:not(:empty) {
@@ -495,12 +496,19 @@
495496
}
496497

497498
.ui.ui.form .fields.@{state} .field label,
499+
.ui.ui.form .fields.@{state} .field .ui.label:not(.corner),
498500
.ui.ui.form .field.@{state} label,
501+
.ui.ui.form .field.@{state} .ui.label:not(.corner),
499502
.ui.ui.form .fields.@{state} .field .input,
500503
.ui.ui.form .field.@{state} .input {
501504
color: @c;
502505
}
503506

507+
.ui.form .fields.@{state} .field .ui.label,
508+
.ui.form .field.@{state} .ui.label {
509+
background-color: @lbg;
510+
}
511+
504512
.ui.form .fields.@{state} .field .corner.label,
505513
.ui.form .field.@{state} .corner.label {
506514
border-color: @c;

src/themes/default/globals/colors.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@
497497
borderRadius: @inputErrorBorderRadius;
498498
boxShadow: @inputErrorBoxShadow;
499499
cornerLabelColor: @white;
500+
labelBackground: darken(@formErrorBorder, -8);
500501

501502
dropdownLabelColor: @dropdownErrorLabelColor;
502503
dropdownLabelBackground: @dropdownErrorLabelBackground;
@@ -524,6 +525,7 @@
524525
borderRadius: @inputInfoBorderRadius;
525526
boxShadow: @inputInfoBoxShadow;
526527
cornerLabelColor: @white;
528+
labelBackground: darken(@formInfoBorder, -8);
527529

528530
dropdownLabelColor: @dropdownInfoLabelColor;
529531
dropdownLabelBackground: @dropdownInfoLabelBackground;
@@ -551,6 +553,7 @@
551553
borderRadius: @inputSuccessBorderRadius;
552554
boxShadow: @inputSuccessBoxShadow;
553555
cornerLabelColor: @white;
556+
labelBackground: darken(@formSuccessBorder, -8);
554557

555558
dropdownLabelColor: @dropdownSuccessLabelColor;
556559
dropdownLabelBackground: @dropdownSuccessLabelBackground;
@@ -578,6 +581,7 @@
578581
borderRadius: @inputWarningBorderRadius;
579582
boxShadow: @inputWarningBoxShadow;
580583
cornerLabelColor: @white;
584+
labelBackground: darken(@formWarningBorder, -8);
581585

582586
dropdownLabelColor: @dropdownWarningLabelColor;
583587
dropdownLabelBackground: @dropdownWarningLabelBackground;

0 commit comments

Comments
 (0)