@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
import { omit } from 'ramda' ;
4
4
import { Label as RSLabel } from 'reactstrap' ;
5
5
import classNames from 'classnames' ;
6
+ import { bootstrapTextColors } from '../private/BootstrapColors' ;
6
7
7
8
const alignMap = {
8
9
start : 'align-self-start' ,
@@ -24,10 +25,13 @@ const Label = props => {
24
25
xs,
25
26
className,
26
27
color,
28
+ style,
27
29
loading_state,
28
30
...otherProps
29
31
} = props ;
30
32
33
+ const isBootstrapColor = bootstrapTextColors . has ( color ) ;
34
+
31
35
// check if column width has been specified, use alignment attribute if so
32
36
const cols = colWidths . filter (
33
37
colWidth => props [ colWidth ] || props [ colWidth ] === ''
@@ -37,14 +41,15 @@ const Label = props => {
37
41
const classes = classNames (
38
42
className ,
39
43
cols . length && alignClass ,
40
- color && `text-${ color } `
44
+ color && isBootstrapColor && `text-${ color } `
41
45
) ;
42
46
43
47
return (
44
48
< RSLabel
45
49
for = { html_for }
46
50
xs = { xs || width }
47
51
className = { classes }
52
+ style = { ! isBootstrapColor ? { color : color , ...style } : style }
48
53
{ ...omit ( [ 'setProps' ] , otherProps ) }
49
54
data-dash-is-loading = {
50
55
( loading_state && loading_state . is_loading ) || undefined
@@ -173,7 +178,8 @@ Label.propTypes = {
173
178
174
179
/**
175
180
* Text color, options: primary, secondary, success, warning, danger, info,
176
- * muted, light, dark, body, white, black-50, white-50.
181
+ * muted, light, dark, body, white, black-50, white-50 or any valid CSS color of
182
+ * your choice (e.g. a hex code, a decimal code or a CSS color name).
177
183
*/
178
184
color : PropTypes . string ,
179
185
0 commit comments