Hi, I want to return the slug of a theme color, but this option doesn’t seem to exist, how to do it please?

I’m using theme colors from functions like this:
array(
	'name'  => esc_attr__('Primary', 'theme'),
	'slug'  => 'primary',
	'color' => $colors['primary'],
),
				
		
	 
	
	
		
	
		
	
		
		
	
	
		
		
			
		
	
	
		
		
		If you convert the value to lowercase and convert any spaces to hyphens, this would be the same as returning the slug.
Would that work?