Astra_Global_Palette::is_dark_palette( string $palette_key = 'current' )
Determines if the specified or active global palette is considered dark.
Description
Parameters
- $palette_key
-
(string) (Optional) The key of the palette to check. Defaults to 'current' to check the active global palette.
Default value: 'current'
Return
(bool) True if the specified or active global palette is dark, otherwise false.
Source
File: inc/class-astra-global-palette.php
public static function is_dark_palette( $palette_key = 'current' ) {
if ( $palette_key === 'current' ) {
if ( ! self::$is_dark_palette ) {
// Determine if the active global palette is 'palette_4', which is considered dark.
self::$is_dark_palette = self::astra_get_active_global_palette() === 'palette_4';
}
// Return the cached result for the active global palette.
return self::$is_dark_palette;
}
// For a specific palette key, directly check if it's 'palette_4'.
return $palette_key === 'palette_4';
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.10.0 | Introduced. |