@@ -17,10 +17,17 @@ import useTranslate from '../helpers/useTranslate';
1717
1818const useStyles = makeStyles ( {
1919 root : {
20- backgroundImage : props => props . backgroundImage || 'none' ,
20+ backgroundImage : props =>
21+ props . alpha < 1
22+ ? `
23+ linear-gradient(45deg, #ccc 25%, transparent 25%),
24+ linear-gradient(135deg, #ccc 25%, transparent 25%),
25+ linear-gradient(45deg, transparent 75%, #ccc 75%),
26+ linear-gradient(135deg, transparent 75%, #ccc 75%)`
27+ : 'none' ,
28+ backgroundSize : '8px 8px' ,
29+ backgroundPosition : '0 0, 4px 0, 4px -4px, 0px 4px' ,
2130 backgroundColor : props => props . backgroundColor || '#fff' ,
22- backgroundSize : props => props . backgroundSize ,
23- backgroundPosition : props => props . backgroundPosition ,
2431 boxShadow : '0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08)' ,
2532 borderColor : props => props . borderColor || '#767676' ,
2633 borderStyle : 'solid' ,
@@ -30,11 +37,22 @@ const useStyles = makeStyles({
3037 width : props => props . width ,
3138 minWidth : props => props . minWidth ,
3239 height : props => props . height ,
33-
34- '&:hover' : {
40+ '& div' : {
41+ content : '" "' ,
42+ backgroundColor : props => props . backgroundColor || '#fff' ,
43+ backgroundSize : '8px 8px' ,
44+ width : props => props . width ,
45+ minWidth : props => props . minWidth ,
46+ height : props => props . height ,
47+ borderColor : props => props . borderColor || '#767676' ,
48+ borderStyle : 'solid' ,
49+ borderWidth : props => props . borderWidth || 0 ,
50+ borderRadius : 4 ,
51+ padding : 0 ,
52+ } ,
53+ '&:hover div' : {
3554 backgroundColor : props => props . hoverColor ,
3655 } ,
37-
3856 '&:active' : {
3957 boxShadow : 'none' ,
4058 } ,
@@ -67,10 +85,10 @@ const ColorButton = ({
6785 const { t, i18n } = useTranslate ( ) ;
6886 const color = ColorTool . validateColor ( c , disableAlpha , t , i18n . language ) ;
6987 const translated = t ( tooltip ) ;
70- const cssColor = color . css ; // || { backgroundColor: ColorTool.getCssColor(color) };
88+ const cssColor = color . css ;
7189 let l = color . hsl [ 2 ] - 10 ;
7290 if ( l < 30 ) l = color . hsl [ 2 ] + 50 ;
73- const a = color . alpha ; // || 0.2;
91+ const a = color . alpha ;
7492 const hoverColor = `hsl(${ color . hsl [ 0 ] } , ${ color . hsl [ 1 ] } %, ${ l } %, ${ a } )` ;
7593 const classes = useStyles ( {
7694 width : size ,
@@ -79,6 +97,7 @@ const ColorButton = ({
7997 hoverColor,
8098 borderColor,
8199 borderWidth,
100+ alpha : a ,
82101 ...cssColor ,
83102 } ) ;
84103 const component = (
@@ -90,7 +109,7 @@ const ColorButton = ({
90109 aria-label = { color . name }
91110 { ...props }
92111 >
93- < span />
112+ < div />
94113 </ Button >
95114 ) ;
96115 if ( tooltip ) {
0 commit comments