import { css2rgbaVector , css2rgbaNumber , css2css , css2hex } from './chroma' ; /**
 * This class represents an instance of a color.
 * You create it by passing in a standard CSS-compatible string and an optional alpha value.
 * Note that some CSS color formats can include alpha, we do this because SVG colors allow separate
 * specification of color and alpha.
 *
 * This class also contains various accessors that transform the color output as noted.
 * Note that the naming of these intentionally matches the string values on the ColorSpace enum.
 */ export class Color { private _raw : string ; private _alpha : number ; constructor ( css , alpha ? ) { this . _raw = css ; this . _alpha = alpha !== undefined ? alpha : 1.0 ; } /**
     * Direct passthrough of string used to create the color, to avoid any transform.
     */ get raw ( ) : string { return this . _raw ; } hex ( alpha ? ) { return css2hex ( this . _raw , alpha || this . _alpha ) ; } css ( alpha ? ) { return css2css ( this . _raw , alpha || this . _alpha ) ; } rgbav ( alpha ? ) { return css2rgbaVector ( this . _raw , alpha || this . _alpha ) ; } rgbaint ( alpha ? ) { return css2rgbaNumber ( this . _raw , alpha || this . _alpha ) ; } toString ( ) { return this . hex ( ) ; } }