我正在使用React-Redux和Material-UI进行样式设计。我在工具栏上有一个
我已经设法更改了复选框的颜色(选中该复选框时)。当未选中时,我还将复选框轮廓的颜色更改为白色。
问题::如果未选中该复选框,则无法更改其背景颜色/填充颜色。它始终与工具栏上的颜色相同(蓝色-#295ED9)。
我尝试将
我可以获得的最佳结果是将
JSX
<div classname="hasBalance">
<FormControlLabel
control={<Checkbox color="primary"/>}
label="Has Balance"
/>
</div>
SCSS
.hasBalance {
grid-area: balance;
.MuiSvgIcon-root {
fill: white;
}
}
Chrome检查工具中的元素
<div class="hasBalance">
<label class="MuiFormControlLabel-root">
<span class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-143 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary" aria-disabled="false">
<span class="MuiIconButton-label">
<input class="PrivateSwitchBase-input-146" type="checkbox" data-indeterminate="false" value="">
<svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path>
</svg>
</span>
<span class="MuiTouchRipple-root"></span>
</span>
<span class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1">Has Balance</span>
</label>
</div>
目标是将未选中的Material-UI复选框的背景色/填充色更改为白色。谢谢。