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

fixed cyclic color import

parent 728af1f9
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
*/ */
/** RGB color triplet expressed as a single number */ /** RGB color triplet expressed as a single number */
type Color = { readonly '@type': 'color' } & number export type Color = { readonly '@type': 'color' } & number
function Color(hex: number) { return hex as Color } export function Color(hex: number) { return hex as Color }
namespace Color { export namespace Color {
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 ]
} }
...@@ -53,4 +53,8 @@ namespace Color { ...@@ -53,4 +53,8 @@ namespace Color {
} }
} }
export default Color type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] }
\ No newline at end of file export function ColorTable<T extends { [k: string]: number[] }>(o: T) { return o as ColorTable<T> }
type ColorMap<T extends { [k: string]: number }> = { [k in keyof T]: Color }
export function ColorMap<T extends { [k: string]: number }>(o: T) { return o as ColorMap<T> }
\ No newline at end of file
...@@ -4,14 +4,6 @@ ...@@ -4,14 +4,6 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
*/ */
import Color from './color' export { Color, ColorMap, ColorTable } from './color'
import { ColorScale } from './scale'; export { ColorScale } from './scale';
type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] }
export function ColorTable<T extends { [k: string]: number[] }>(o: T) { return o as ColorTable<T> }
type ColorMap<T extends { [k: string]: number }> = { [k in keyof T]: Color }
export function ColorMap<T extends { [k: string]: number }>(o: T) { return o as ColorMap<T> }
export { Color, ColorScale }
export { ColorBrewer, ColorNames } from './tables' export { ColorBrewer, ColorNames } from './tables'
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
*/ */
import Color from './color' import { Color } from './color'
import { ColorBrewer } from './tables' import { ColorBrewer } from './tables'
export interface ColorScale { export interface ColorScale {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
*/ */
import { ColorMap, ColorTable } from './index'; import { ColorMap, ColorTable } from './color';
/** /**
* Brewer Color Lists * Brewer Color Lists
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment