astra_addon_is_dark_palette( string $palette_key = 'current' )
Determines if the specified palette key corresponds to a dark palette.
Description
Parameters
- $palette_key
-
(string) (Optional) The key of the palette to check. Defaults to 'current' which indicates the current global palette.
Default value: 'current'
Return
(bool) Returns true if the palette key is associated with a dark palette, false otherwise.
Source
File: classes/astra-common-functions.php
function astra_addon_is_dark_palette( $palette_key = 'current' ) {
if ( $palette_key === 'current' ) {
// Check if the 'is_dark_palette' method exists and use it to determine if the current palette is dark.
if ( method_exists( 'Astra_Global_Palette', 'is_dark_palette' ) ) {
return Astra_Global_Palette::is_dark_palette();
}
// If the 'is_dark_palette' method does not exist, try to get the active global palette key.
if ( method_exists( 'Astra_Global_Palette', 'astra_get_active_global_palette' ) ) {
$palette_key = Astra_Global_Palette::astra_get_active_global_palette();
}
}
return $palette_key === 'palette_4';
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.10.0 | Introduced. |