Title: wp_tinycolor_hsl_to_rgb
Published: August 8, 2023
Last modified: August 20, 2026

---

# wp_tinycolor_hsl_to_rgb( array $hsl_color ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#changelog)

This function has been deprecated since 6.3.0.

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Converts an HSL object to an RGB object with converted and rounded values.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#description)󠁿

Direct port of TinyColor’s function, lightly simplified to maintain consistency 
with TinyColor.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#parameters)󠁿

 `$hsl_color`arrayrequired

HSL object.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#return)󠁿

 array Rounded and converted RGB object.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#source)󠁿

    ```php
    function wp_tinycolor_hsl_to_rgb( $hsl_color ) {
    	_deprecated_function( __FUNCTION__, '6.3.0' );

    	$h = wp_tinycolor_bound01( $hsl_color['h'], 360 );
    	$s = wp_tinycolor_bound01( $hsl_color['s'], 100 );
    	$l = wp_tinycolor_bound01( $hsl_color['l'], 100 );

    	if ( 0 === $s ) {
    		// Achromatic.
    		$r = $l;
    		$g = $l;
    		$b = $l;
    	} else {
    		$q = $l < 0.5 ? $l * ( 1 + $s ) : $l + $s - $l * $s;
    		$p = 2 * $l - $q;
    		$r = wp_tinycolor_hue_to_rgb( $p, $q, $h + 1 / 3 );
    		$g = wp_tinycolor_hue_to_rgb( $p, $q, $h );
    		$b = wp_tinycolor_hue_to_rgb( $p, $q, $h - 1 / 3 );
    	}

    	return array(
    		'r' => $r * 255,
    		'g' => $g * 255,
    		'b' => $b * 255,
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/deprecated.php#L4958)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/deprecated.php#L4958-L4983)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_tinycolor_bound01()](https://developer.wordpress.org/reference/functions/wp_tinycolor_bound01/)`wp-includes/deprecated.php` |

Takes input from [0, n] and returns it as [0, 1].

  | 
| [wp_tinycolor_hue_to_rgb()](https://developer.wordpress.org/reference/functions/wp_tinycolor_hue_to_rgb/)`wp-includes/deprecated.php` |

Helper function for hsl to rgb conversion.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#)

| Used by | Description | 
| [wp_tinycolor_string_to_rgb()](https://developer.wordpress.org/reference/functions/wp_tinycolor_string_to_rgb/)`wp-includes/deprecated.php` |

Parses hex, hsl, and rgb CSS strings using the same regex as TinyColor v1.4.2 used in the JavaScript. Only colors output from react-color are implemented.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_tinycolor_hsl_to_rgb/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | Deprecated.  | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_tinycolor_hsl_to_rgb%2F)
before being able to contribute a note or feedback.