Skip to content

Commit 1af26c7

Browse files
committed
refactor: utilities/get-color
1 parent 654142d commit 1af26c7

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

js/src/utilities/get-color.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@
44
* Licensed under MIT (https://coreui.io/license)
55
* --------------------------------------------------------------------------
66
*/
7-
import getCssCustomProperties from './get-css-custom-properties'
8-
9-
const minIEVersion = 10
10-
const isIE1x = () => Boolean(document.documentMode) && document.documentMode >= minIEVersion
11-
const isCustomProperty = (property) => property.match(/^--.*/i)
7+
import getStyle from './get-style'
128

139
const getColor = (rawProperty, element = document.body) => {
1410
const property = `--${rawProperty}`
15-
let style
16-
if (isCustomProperty(property) && isIE1x()) {
17-
const cssCustomProperties = getCssCustomProperties()
18-
style = cssCustomProperties[property]
19-
} else {
20-
style = window.getComputedStyle(element, null).getPropertyValue(property).replace(/^\s/, '')
21-
}
11+
const style = getStyle(property, element)
2212
return style ? style : rawProperty
2313
}
2414

0 commit comments

Comments
 (0)