You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					19 lines
				
				545 B
			
		
		
			
		
	
	
					19 lines
				
				545 B
			| 
								 
											3 years ago
										 
									 | 
							
								// @flow
							 | 
						||
| 
								 | 
							
								import hslToRgb from './_hslToRgb'
							 | 
						||
| 
								 | 
							
								import reduceHexValue from './_reduceHexValue'
							 | 
						||
| 
								 | 
							
								import toHex from './_numberToHex'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function colorToHex(color: number): string {
							 | 
						||
| 
								 | 
							
								  return toHex(Math.round(color * 255))
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function convertToHex(red: number, green: number, blue: number): string {
							 | 
						||
| 
								 | 
							
								  return reduceHexValue(`#${colorToHex(red)}${colorToHex(green)}${colorToHex(blue)}`)
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function hslToHex(hue: number, saturation: number, lightness: number): string {
							 | 
						||
| 
								 | 
							
								  return hslToRgb(hue, saturation, lightness, convertToHex)
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default hslToHex
							 |