Astra_Global_Palette::get_color_by_palette_variable( string $color )

Pass hex value for global palette to process forground color.


Description


Parameters

$color

(string) (Required) hex color / css variable.


Return

(string)


Source

File: inc/class-astra-global-palette.php

	public function get_color_by_palette_variable( $color ) {
		// Check if color is CSS variable.
		if ( 0 === strpos( $color, 'var(--' ) ) {

			$global_palette = astra_get_option( 'global-color-palette' );

			foreach ( $global_palette['palette'] as $palette_index => $value ) {

				if ( 'var(' . self::get_css_variable_prefix() . $palette_index . ')' === $color ) {
					return $value;
				}
			}
		}

		return $color;
	}

Changelog

Changelog
Version Description
3.7.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.