File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ export const TextInput = styled.input.attrs((p: { type?: string }) => ({
151151 opacity: 0.6;
152152 }
153153
154+ &::placeholder {
155+ color: ${ p => p . theme . inputPlaceholderColor } ;
156+ }
157+
154158 &:invalid {
155159 ${ invalidTextCss }
156160 }
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export const lightTheme = {
7171 inputHoverBackground : greyWhite ,
7272 inputBorder : darkGrey ,
7373 inputColor : inkGrey ,
74+ inputPlaceholderColor : darkishGrey ,
7475
7576 highlightBackground : white ,
7677 highlightColor : inkGrey ,
@@ -124,6 +125,7 @@ export const darkTheme = {
124125 inputHoverBackground : inkGrey ,
125126 inputBorder : darkishGrey ,
126127 inputColor : white ,
128+ inputPlaceholderColor : mediumGrey ,
127129
128130 highlightBackground : darkishGrey ,
129131 highlightColor : white ,
@@ -198,6 +200,7 @@ export const highContrastTheme = {
198200 inputHoverBackground : '#ddd' ,
199201 inputBorder : '#aaa' ,
200202 inputColor : '#000000' ,
203+ inputPlaceholderColor : '#444' ,
201204
202205 highlightBackground : '#ffffff' ,
203206 highlightColor : '#000' ,
Original file line number Diff line number Diff line change @@ -68,6 +68,16 @@ import { expect } from '../test-setup';
6868 ) ;
6969 } ) ;
7070
71+ it ( "should have sufficient input placeholder contrast" , ( ) => {
72+ const mainColor = theme . inputPlaceholderColor ;
73+ const bgColor = theme . inputBackground ;
74+
75+ const contrast = polished . getContrast ( mainColor , bgColor ) ;
76+ expect ( contrast ) . to . be . greaterThan ( normalContrastTarget ,
77+ `Constrast for ${ mainColor } /${ bgColor } was only ${ contrast } `
78+ ) ;
79+ } ) ;
80+
7181 it ( "should have sufficient primary button contrast" , ( ) => {
7282 const mainColor = theme . primaryInputColor ;
7383 const bgColor = theme . primaryInputBackground ;
You can’t perform that action at this time.
0 commit comments