Skip to content
Snippets Groups Projects
Commit 4d78a9f1 authored by Alexander Rose's avatar Alexander Rose
Browse files

added Color.toRgbString

parent 7d7244e6
No related branches found
No related tags found
No related merge requests found
...@@ -174,7 +174,7 @@ function ColorOptions() { ...@@ -174,7 +174,7 @@ function ColorOptions() {
function ColorValueOption(color: Color) { function ColorValueOption(color: Color) {
return !ColorNamesValueMap.has(color) ? <option key={Color.toHexString(color)} value={color} style={{ background: `${Color.toStyle(color)}` }} > return !ColorNamesValueMap.has(color) ? <option key={Color.toHexString(color)} value={color} style={{ background: `${Color.toStyle(color)}` }} >
{Color.toHexString(color)} {Color.toRgbString(color)}
</option> : null </option> : null
} }
......
...@@ -18,6 +18,10 @@ export namespace Color { ...@@ -18,6 +18,10 @@ export namespace Color {
return '0x' + ('000000' + hexColor.toString(16)).slice(-6) return '0x' + ('000000' + hexColor.toString(16)).slice(-6)
} }
export function toRgbString(hexColor: Color) {
return `RGB: ${Color.toRgb(hexColor).join(', ')}`
}
export function toRgb(hexColor: Color) { export function toRgb(hexColor: Color) {
return [ hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255 ] return [ hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255 ]
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment