Compare commits
2
Commits
1dc206c4b4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2c272e7a3 | ||
|
|
00031119ac |
@@ -1179,3 +1179,37 @@ export function formatColor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Specified Color Identifier Value ...
|
||||
*
|
||||
* @param color Color Identifier ...
|
||||
*
|
||||
* @returns an string value which represent color ...
|
||||
*/
|
||||
export function getXColorValue(color: XColorIdentifier) {
|
||||
//
|
||||
let result = '';
|
||||
|
||||
//
|
||||
if (!isNullOrUndefined(color)) {
|
||||
//
|
||||
const descriptor = parseXColor(color);
|
||||
if (!isNullOrUndefined(descriptor)) {
|
||||
//
|
||||
var colorCssVarName = getXColorCssVariableName(
|
||||
descriptor.name,
|
||||
descriptor.isContrast,
|
||||
descriptor.brightnessLevel,
|
||||
);
|
||||
if (!isNullOrEmptyString(colorCssVarName)) {
|
||||
//
|
||||
const computedStyle = getComputedStyle(document.documentElement);
|
||||
result = computedStyle.getPropertyValue(colorCssVarName.trim()).trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user