getStyle method

dynamic getStyle([
  1. String colorSpace = SRGBColorSpace
])

Implementation

getStyle( [String colorSpace = SRGBColorSpace] ) {

	ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );

	if ( colorSpace != SRGBColorSpace ) {

		// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
		return "color($colorSpace  ${ _rgb["r"] } ${ _rgb["g"] } ${ _rgb["b"] })";

	}

	return "rgb(${( _rgb["r"]! * 255 )},${( _rgb["g"]! * 255 )},${( _rgb["b"]! * 255 )})";
  }