我正在前端使用 react 和 MaterialUI 进行开发,并且我有一堆自定义输入。除了这个之外,一切都运行良好。无论我使用哪种选择器组合,我似乎都无法指向正确的选择器来更改这种黑色。
此外,如果能够通过查看元素选择器以明确的方式进行识别,从而深入到正确的组件中,那就太好了。有没有办法做到这一点(教一个人钓鱼之类的东西)。这是我检查元素时的图像以及我试图获得的颜色。
这是样式对象:
toggleToUse = {
switchBase: {},
thumb: {
color: colorUsedByInputs,
opacity: 0.6,
marginLeft: '10.2px'
},
track: {
background: 'grey',
opacity: '1 !important',
borderRadius: 20,
position: 'relative',
'&:before, &:after': {
display: 'inline-block',
position: 'absolute',
top: '50%',
width: '50%',
transform: 'translateY(-50%)',
color: '#fff',
textAlign: 'center'
}
},
checked: {
'&$switchBase': {
color: '#185a9d',
transform: 'translateX(32px)',
'&:hover': {
backgroundColor: 'rgba(24,90,257,0.08)'
}
},
'& $thumb': {
backgroundColor: '#fff'
},
'& + $track': {
background: 'linear-gradient(to right, rgba(43, 56, 97, 0.7), #2b3861)',
'&:before': {
opacity: 1
},
'&:after': {
opacity: 0
}
}
}
};